Skip to content

Commit e6a6017

Browse files
committed
Remove HAVE_STRERROR
Checking for the strerror function presence is no longer needed since it is part of the C89 standard [1] and can be safely assumed that all current systems have it. Check in the configure.ac and Windows defined symbol are still left until the file library (libmagic) will be updated. [1]: https://port70.net/~nsz/c/c89/c89-draft.html
1 parent 07df659 commit e6a6017

File tree

3 files changed

+0
-27
lines changed

3 files changed

+0
-27
lines changed

ext/standard/php_string.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,11 +143,6 @@ PHPAPI int string_natural_compare_function_ex(zval *result, zval *op1, zval *op2
143143
PHPAPI int string_natural_compare_function(zval *result, zval *op1, zval *op2);
144144
PHPAPI int string_natural_case_compare_function(zval *result, zval *op1, zval *op2);
145145

146-
#ifndef HAVE_STRERROR
147-
PHPAPI char *php_strerror(int errnum);
148-
#define strerror php_strerror
149-
#endif
150-
151146
#ifndef HAVE_MBLEN
152147
# define php_mblen(ptr, len) 1
153148
# define php_mb_reset()

ext/standard/string.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3732,24 +3732,6 @@ PHP_FUNCTION(stripslashes)
37323732
}
37333733
/* }}} */
37343734

3735-
#ifndef HAVE_STRERROR
3736-
/* {{{ php_strerror
3737-
*/
3738-
char *php_strerror(int errnum)
3739-
{
3740-
extern int sys_nerr;
3741-
extern char *sys_errlist[];
3742-
3743-
if ((unsigned int) errnum < sys_nerr) {
3744-
return(sys_errlist[errnum]);
3745-
}
3746-
3747-
(void) snprintf(BG(str_ebuf), sizeof(php_basic_globals.str_ebuf), "Unknown error: %d", errnum);
3748-
return(BG(str_ebuf));
3749-
}
3750-
/* }}} */
3751-
#endif
3752-
37533735
/* {{{ php_stripcslashes
37543736
*/
37553737
PHPAPI void php_stripcslashes(zend_string *str)

main/php.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,6 @@ typedef unsigned int socklen_t;
230230
#include "zend_stack.h"
231231
#include <string.h>
232232

233-
#ifndef HAVE_STRERROR
234-
char *strerror(int);
235-
#endif
236-
237233
#if HAVE_PWD_H
238234
# ifdef PHP_WIN32
239235
#include "win32/param.h"

0 commit comments

Comments
 (0)