diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/aspell/aspell.c | 5 | ||||
-rw-r--r-- | ext/db/db.c | 2 | ||||
-rw-r--r-- | ext/ereg/php_regex.h | 3 | ||||
-rw-r--r-- | ext/hyperwave/hg_comm.c | 4 | ||||
-rw-r--r-- | ext/mysql/php_mysql.c | 38 | ||||
-rw-r--r-- | ext/oci8/oci8.c | 2 | ||||
-rw-r--r-- | ext/posix/posix.c | 4 | ||||
-rw-r--r-- | ext/standard/basic_functions.c | 2 | ||||
-rw-r--r-- | ext/standard/browscap.c | 1 | ||||
-rw-r--r-- | ext/standard/dl.c | 10 | ||||
-rw-r--r-- | ext/standard/exec.c | 21 | ||||
-rw-r--r-- | ext/standard/head.c | 123 | ||||
-rw-r--r-- | ext/standard/mail.c | 6 | ||||
-rw-r--r-- | ext/standard/php_string.h | 41 | ||||
-rw-r--r-- | ext/standard/string.c | 4 | ||||
-rw-r--r-- | ext/standard/url.c | 2 |
16 files changed, 38 insertions, 230 deletions
diff --git a/ext/aspell/aspell.c b/ext/aspell/aspell.c index b942517ba2..5866a66b57 100644 --- a/ext/aspell/aspell.c +++ b/ext/aspell/aspell.c @@ -29,11 +29,6 @@ #if HAVE_ASPELL #include "php_aspell.h" -#if APACHE -# ifndef DEBUG -# undef palloc -# endif -#endif #include <aspell-c.h> function_entry aspell_functions[] = { diff --git a/ext/db/db.c b/ext/db/db.c index 5b0eb11282..e4e5b51d3b 100644 --- a/ext/db/db.c +++ b/ext/db/db.c @@ -317,7 +317,7 @@ dbm_info *php_dbm_open(char *filename, char *mode) { #if NFS_HACK while((last_try = stat(lockfn,&sb))==0) { retries++; - sleep(1); + php_sleep(1); if (retries>30) break; } if (last_try!=0) { diff --git a/ext/ereg/php_regex.h b/ext/ereg/php_regex.h index be0f445af7..f4dc865163 100644 --- a/ext/ereg/php_regex.h +++ b/ext/ereg/php_regex.h @@ -5,10 +5,9 @@ * REGEX means: * 0.. system regex * 1.. bundled regex - * 2.. Apache's regex */ -#if REGEX == 1 +#if REGEX /* get aliases */ #include "regex/regex_extra.h" #include "regex/regex.h" diff --git a/ext/hyperwave/hg_comm.c b/ext/hyperwave/hg_comm.c index 1138df59b6..20ed8d683e 100644 --- a/ext/hyperwave/hg_comm.c +++ b/ext/hyperwave/hg_comm.c @@ -1137,7 +1137,7 @@ static int hg_read(int sockfd, char *buf, int size) if ( (errno == EAGAIN) || (errno == EWOULDBLOCK) ) { if ( ++try > 5 ) return(-1); - sleep(1); + php_sleep(1); } else return(-1); } @@ -1159,7 +1159,7 @@ static int hg_write(int sockfd, char *buf, int size) if ( (errno == EAGAIN) || (errno == EWOULDBLOCK) ) { if ( ++try > 5 ) return(-1); - sleep(1); + php_sleep(1); } else return(-1); } diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c index f02382d2fe..57c3add055 100644 --- a/ext/mysql/php_mysql.c +++ b/ext/mysql/php_mysql.c @@ -158,9 +158,6 @@ PHP_MYSQL_API php_mysql_globals mysql_globals; DLEXPORT zend_module_entry *get_module(void) { return &mysql_module_entry; } #endif -#if APACHE -void timeout(int sig); -#endif #define CHECK_LINK(link) { if (link==-1) { php_error(E_WARNING,"MySQL: A link to the server could not be established"); RETURN_FALSE; } } @@ -187,42 +184,19 @@ static void php_mysql_set_default_link(int id) static void _close_mysql_link(MYSQL *link) { -#if APACHE - void (*handler) (int); -#endif MySLS_FETCH(); -#if APACHE - handler = signal(SIGPIPE, SIG_IGN); -#endif - mysql_close(link); - -#if APACHE - signal(SIGPIPE,handler); -#endif - efree(link); MySG(num_links)--; } static void _close_mysql_plink(MYSQL *link) { -#if APACHE - void (*handler) (int); -#endif MySLS_FETCH(); -#if APACHE - handler = signal(SIGPIPE, SIG_IGN); -#endif - mysql_close(link); -#if APACHE - signal(SIGPIPE,handler); -#endif - free(link); MySG(num_persistent)--; MySG(num_links)--; @@ -338,9 +312,6 @@ PHP_MINFO_FUNCTION(mysql) static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) { -#if APACHE - void (*handler) (int); -#endif char *user,*passwd,*host,*socket=NULL,*tmp; char *hashed_details; int hashed_details_length,port = MYSQL_PORT; @@ -478,18 +449,12 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) RETURN_FALSE; } /* ensure that the link did not die */ -#if APACHE - handler=signal(SIGPIPE,SIG_IGN); -#endif #if defined(HAVE_MYSQL_ERRNO) && defined(CR_SERVER_GONE_ERROR) mysql_stat(le->ptr); if (mysql_errno((MYSQL *)le->ptr) == CR_SERVER_GONE_ERROR) { #else if (!strcasecmp(mysql_stat(le->ptr),"mysql server has gone away")) { /* the link died */ #endif -#if APACHE - signal(SIGPIPE,handler); -#endif #if MYSQL_VERSION_ID > 32199 /* this lets us set the port number */ if (mysql_real_connect(le->ptr,host,user,passwd,NULL,port,socket,0)==NULL) { #else @@ -501,9 +466,6 @@ static void php_mysql_do_connect(INTERNAL_FUNCTION_PARAMETERS,int persistent) RETURN_FALSE; } } -#if APACHE - signal(SIGPIPE,handler); -#endif mysql = (MYSQL *) le->ptr; } ZEND_REGISTER_RESOURCE(return_value, mysql, le_plink); diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index 85b9a391f5..8304a0bb83 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -1642,7 +1642,7 @@ oci_failover_callback(dvoid *svchp, case OCI_FO_ERROR: { printf(" Failover error gotten. Sleeping...\n"); - sleep(3); + php_sleep(3); /* cannot find this blody define !!! return OCI_FO_RETRY; */ break; } diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 37d6fa39c6..8d32d82a69 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -132,10 +132,6 @@ zend_module_entry posix_module_entry = { DLEXPORT zend_module_entry *get_module(void) { return &posix__module_entry; } #endif -#if APACHE -void timeout(int sig); -#endif - static PHP_MINFO_FUNCTION(posix) { PUTS("$Revision$\n"); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 2309df2db2..953eebe7f2 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -664,7 +664,7 @@ PHP_FUNCTION(sleep) WRONG_PARAM_COUNT; } convert_to_long_ex(num); - sleep((*num)->value.lval); + php_sleep((*num)->value.lval); } PHP_FUNCTION(usleep) diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index c6ea118081..f29429e2d4 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -17,6 +17,7 @@ */ #include "php.h" +#include "php_regex.h" #include "php_browscap.h" #include "php_ini.h" diff --git a/ext/standard/dl.c b/ext/standard/dl.c index 471ef75e9a..86decf5d37 100644 --- a/ext/standard/dl.c +++ b/ext/standard/dl.c @@ -104,7 +104,7 @@ void php_dl(pval *file,int type,pval *return_value) } /* load dynamic symbol */ - handle = dlopen(libpath, RTLD_LAZY); + handle = DL_LOAD(libpath); if (!handle) { int error_type; @@ -120,10 +120,10 @@ void php_dl(pval *file,int type,pval *return_value) #endif RETURN_FALSE; } - get_module = (zend_module_entry *(*)(void)) dlsym(handle, "get_module"); + get_module = (zend_module_entry *(*)(void)) DL_FETCH_SYMBOL(handle, "get_module"); if (!get_module) { - dlclose(handle); + DL_UNLOAD(handle); php_error(E_CORE_WARNING,"Invalid library (maybe not a PHP library) '%s' ",file->value.str.val); RETURN_FALSE; } @@ -133,7 +133,7 @@ void php_dl(pval *file,int type,pval *return_value) if (module_entry->module_startup_func) { if (module_entry->module_startup_func(type, module_entry->module_number ELS_CC)==FAILURE) { php_error(E_CORE_WARNING,"%s: Unable to initialize module",module_entry->name); - dlclose(handle); + DL_UNLOAD(handle); RETURN_FALSE; } } @@ -143,7 +143,7 @@ void php_dl(pval *file,int type,pval *return_value) if (module_entry->request_startup_func) { if (module_entry->request_startup_func(type, module_entry->module_number ELS_CC)) { php_error(E_CORE_WARNING,"%s: Unable to initialize module",module_entry->name); - dlclose(handle); + DL_UNLOAD(handle); RETURN_FALSE; } } diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 53394a4b36..c450d17ecd 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -145,27 +145,8 @@ static int _Exec(int type, char *cmd, pval *array, pval *return_value) if (type == 1) { -#if APACHE - SLS_FETCH(); -#endif - if (output) PUTS(buf); -#if APACHE -# if MODULE_MAGIC_NUMBER > 19970110 - if (output) rflush(((request_rec *) SG(server_context))); -# else - if (output) bflush(((request_rec *) SG(server_context))->connection->client); -# endif -#endif -#if CGI_BINARY - fflush(stdout); -#endif -#if FHTTPD - /* fhttpd doesn't flush */ -#endif -#if USE_SAPI - sapi_rqst->flush(sapi_rqst->scid); -#endif + sapi_flush(); } else if (type == 2) { /* strip trailing whitespaces */ diff --git a/ext/standard/head.c b/ext/standard/head.c index 493703e772..23f5f58efb 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -58,133 +58,10 @@ PHP_RINIT_FUNCTION(head) } -#if 0 -/* Adds header information */ -void php4i_add_header_information(char *header_information, uint header_length) -{ - char *r; -#if APACHE - char *rr = NULL; - char *temp = NULL; - long myuid = 0L; - char temp2[32]; - request_rec *req; - SLS_FETCH(); - - req = ((request_rec *) SG(server_context)); -#endif - - if (php_header_printed == 1) { -#if DEBUG - php_error(E_WARNING, "Cannot add more header information - the header was already sent " - "(header information may be added only before any output is generated from the script - " - "check for text or whitespace outside PHP tags, or calls to functions that output text)"); -#endif - return; /* too late, already sent */ - } -#if APACHE - /* - * Not entirely sure this is the right way to support the header - * command in the Apache module. Comments? - */ - r = strchr(header_information, ':'); - if (r) { - *r = '\0'; - if (!strcasecmp(header_information, "Content-type")) { - if (*(r + 1) == ' ') - req->content_type = pstrdup(req->pool,r + 2); - else - req->content_type = pstrdup(req->pool,r + 1); - cont_type = (char *) req->content_type; - } else { - if (*(r + 1) == ' ') { - rr = r + 2; - } else { - rr = r + 1; - } - if (PG(safe_mode) && (!strcasecmp(header_information, "WWW-authenticate"))) { - myuid = php_getuid(); - sprintf(temp2, "realm=\"%ld ", myuid); /* SAFE */ - temp = php_reg_replace("realm=\"", temp2, rr, 1, 0); - if (!strcmp(temp, rr)) { - sprintf(temp2, "realm=%ld", myuid); /* SAFE */ - temp = php_reg_replace("realm=", temp2, rr, 1, 0); - if (!strcmp(temp, rr)) { - sprintf(temp2, " realm=%ld", myuid); /* SAFE */ - temp = php_reg_replace("$", temp2, rr, 0, 0); - } - } - table_set(req->headers_out, header_information, temp); - } else - table_set(req->headers_out, header_information, rr); - } - if (!strcasecmp(header_information, "location")) { - req->status = REDIRECT; - } - *r = ':'; - php_header_printed = 2; - } - if (!strncasecmp(header_information, "http/", 5)) { - if (strlen(header_information) > 9) { - req->status = atoi(&((header_information)[9])); - } - /* Use a pstrdup here to get the memory straight from Apache's per-request pool to - * avoid having our own memory manager complain about this memory not being freed - * because it really shouldn't be freed until the end of the request and it isn't - * easy for us to figure out when we allocated it vs. when something else might have. - */ - req->status_line = pstrdup(req->pool,&((header_information)[9])); - } -#else - r = strchr(header_information, ':'); - if (r) { - *r = '\0'; - if (!strcasecmp(header_information, "Content-type")) { - if (cont_type) efree(cont_type); - cont_type = estrdup(r + 1); -#if 0 /*WIN32|WINNT / *M$ does us again*/ - if (!strcmp(cont_type," text/html")){ - *r=':'; - PUTS_H(header_information); - PUTS_H("\015\012"); - } -#endif - } else { - *r = ':'; -#if USE_SAPI - { - char *tempstr=emalloc(strlen(header_information)+2); - - sprintf(tempstr,"%s\015\012",tempstr); - sapi_rqst->header(sapi_rqst->scid,tempstr); - efree(tempstr); - } -#else - PUTS_H(header_information); - PUTS_H("\015\012"); -#endif - } - } else { -#if USE_SAPI - { - char *tempstr=emalloc(strlen(header_information)+2); - sprintf(tempstr,"%s\015\012",tempstr); - sapi_rqst->header(sapi_rqst->scid,tempstr); - efree(tempstr); - } -#else - PUTS_H(header_information); - PUTS_H("\015\012"); -#endif - } -#endif -} -#else void php4i_add_header_information(char *header_information, uint header_length) { sapi_add_header(header_information, header_length); } -#endif /* Implementation of the language Header() function */ diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 7657ef6ba7..d87861a605 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -28,12 +28,6 @@ #include "php_mail.h" #include "php_ini.h" -#if APACHE -# ifndef DEBUG -# undef palloc -# endif -#endif - #if HAVE_SENDMAIL #if MSVC5 #include "win32/sendmail.h" diff --git a/ext/standard/php_string.h b/ext/standard/php_string.h index 74f0b899d8..467e85789e 100644 --- a/ext/standard/php_string.h +++ b/ext/standard/php_string.h @@ -83,26 +83,31 @@ PHP_FUNCTION(strip_tags); PHP_FUNCTION(str_repeat); PHP_FUNCTION(substr_replace); -extern PHPAPI char *php_strtoupper(char *s, size_t len); -extern PHPAPI char *php_strtolower(char *s, size_t len); -extern PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen); -extern PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit); -extern PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int freeit, char *what, int wlength); -extern PHPAPI void php_stripslashes(char *str, int *len); -extern PHPAPI void php_stripcslashes(char *str, int *len); -extern PHPAPI void php_dirname(char *str, int len); -extern PHPAPI char *php_stristr(unsigned char *s, unsigned char *t, size_t s_len, size_t t_len); -extern PHPAPI char *php_str_to_str(char *haystack, int length, char *needle, +PHPAPI char *php_strtoupper(char *s, size_t len); +PHPAPI char *php_strtolower(char *s, size_t len); +PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int trlen); +PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit); +PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int freeit, char *what, int wlength); +PHPAPI void php_stripslashes(char *str, int *len); +PHPAPI void php_stripcslashes(char *str, int *len); +PHPAPI void php_dirname(char *str, int len); +PHPAPI char *php_stristr(unsigned char *s, unsigned char *t, size_t s_len, size_t t_len); +PHPAPI char *php_str_to_str(char *haystack, int length, char *needle, int needle_len, char *str, int str_len, int *_new_length); -extern PHPAPI void php_trim(pval *str, pval *return_value, int mode); -extern PHPAPI void php_strip_tags(char *rbuf, int len, int state, char *allow, int allow_len); +PHPAPI void php_trim(pval *str, pval *return_value, int mode); +PHPAPI void php_strip_tags(char *rbuf, int len, int state, char *allow, int allow_len); -extern PHPAPI void php_char_to_str(char *str, uint len, char from, char *to, int to_len, pval *result); +PHPAPI void php_char_to_str(char *str, uint len, char from, char *to, int to_len, pval *result); -extern PHPAPI void php_implode(pval *delim, pval *arr, pval *return_value); -extern PHPAPI void php_explode(pval *delim, pval *str, pval *return_value); -extern PHPAPI inline char *php_memnstr(char *haystack, char *needle, int needle_len, char *end); -extern PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end); -extern PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end); +PHPAPI void php_implode(pval *delim, pval *arr, pval *return_value); +PHPAPI void php_explode(pval *delim, pval *str, pval *return_value); +PHPAPI inline char *php_memnstr(char *haystack, char *needle, int needle_len, char *end); +PHPAPI size_t php_strspn(char *s1, char *s2, char *s1_end, char *s2_end); +PHPAPI size_t php_strcspn(char *s1, char *s2, char *s1_end, char *s2_end); + +#ifndef HAVE_STRERROR +PHPAPI char *php_strerror(int errnum); +#define strerror php_strerror +#endif #endif /* _PHPSTRING_H */ diff --git a/ext/standard/string.c b/ext/standard/string.c index a9f767a82c..f3cd2bda12 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1503,8 +1503,7 @@ PHP_FUNCTION(stripslashes) /* }}} */ #ifndef HAVE_STRERROR -#if !APACHE -char *strerror(int errnum) +char *php_strerror(int errnum) { extern int sys_nerr; extern char *sys_errlist[]; @@ -1515,7 +1514,6 @@ char *strerror(int errnum) return(BG(str_ebuf)); } #endif -#endif PHPAPI void php_stripcslashes(char *str, int *len) { diff --git a/ext/standard/url.c b/ext/standard/url.c index f37500f984..e8e85b3b41 100644 --- a/ext/standard/url.c +++ b/ext/standard/url.c @@ -27,7 +27,7 @@ #include "url.h" #ifdef _OSD_POSIX #ifndef APACHE -#error On this EBCDIC platform, PHP3 is only supported as an Apache module. +#error On this EBCDIC platform, PHP is only supported as an Apache module. #else /*APACHE*/ #ifndef CHARSET_EBCDIC #define CHARSET_EBCDIC /* this machine uses EBCDIC, not ASCII! */ |