diff options
author | Sascha Schumann <sas@php.net> | 2000-05-04 10:38:17 +0000 |
---|---|---|
committer | Sascha Schumann <sas@php.net> | 2000-05-04 10:38:17 +0000 |
commit | d0f3764ee2e10003d9c8ea4a1c17ff0be1303a9b (patch) | |
tree | 10e61089a99c0d3226533f4b15693a45d82a931a | |
parent | b6e4841ec7bcdc1b4fd3533fd4ffeefdac095d52 (diff) | |
download | php-git-d0f3764ee2e10003d9c8ea4a1c17ff0be1303a9b.tar.gz |
Change reentrancy API to always use the php prefix.
Check for the declaration of reentrant functions, so that we can use
them in non-ZTS mode on all platforms.
-rw-r--r-- | acinclude.m4 | 32 | ||||
-rw-r--r-- | configure.in | 1 | ||||
-rw-r--r-- | ext/calendar/cal_unix.c | 2 | ||||
-rw-r--r-- | ext/filepro/filepro.c | 14 | ||||
-rw-r--r-- | ext/ftp/ftp.c | 2 | ||||
-rw-r--r-- | ext/hyperwave/hw.c | 16 | ||||
-rw-r--r-- | ext/session/session.c | 2 | ||||
-rw-r--r-- | ext/standard/datetime.c | 16 | ||||
-rw-r--r-- | ext/standard/info.c | 2 | ||||
-rw-r--r-- | ext/standard/parsedate.y | 14 | ||||
-rw-r--r-- | main/main.c | 6 | ||||
-rw-r--r-- | main/php_reentrancy.h | 45 | ||||
-rw-r--r-- | main/php_variables.c | 14 | ||||
-rw-r--r-- | main/reentrancy.c | 20 | ||||
-rw-r--r-- | sapi/isapi/php4isapi.c | 4 | ||||
-rw-r--r-- | win32/registry.c | 4 |
16 files changed, 121 insertions, 73 deletions
diff --git a/acinclude.m4 b/acinclude.m4 index 31551a36ea..6ce670f417 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -4,6 +4,36 @@ dnl This file contains local autoconf functions. sinclude(dynlib.m4) +AC_DEFUN(PHP_MISSING_TIME_R_DECL,[ + AC_MSG_CHECKING(for missing declarations of reentrant functions) + AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = localtime_r],[ + : + ],[ + AC_DEFINE(MISSING_LOCALTIME_R_DECL,1,[Whether localtime_r is declared]) + ]) + AC_TRY_COMPILE([#include <time.h>],[struct tm *(*func)() = gmtime_r],[ + : + ],[ + AC_DEFINE(MISSING_GMTIME_R_DECL,1,[Whether gmtime_r is declared]) + ]) + AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = asctime_r],[ + : + ],[ + AC_DEFINE(MISSING_ASCTIME_R_DECL,1,[Whether asctime_r is declared]) + ]) + AC_TRY_COMPILE([#include <time.h>],[char *(*func)() = ctime_r],[ + : + ],[ + AC_DEFINE(MISSING_CTIME_R_DECL,1,[Whether ctime_r is declared]) + ]) + AC_TRY_COMPILE([#include <string.h>],[char *(*func)() = strtok_r],[ + : + ],[ + AC_DEFINE(MISSING_STRTOK_R_DECL,1,[Whether strtok_r is declared]) + ]) + AC_MSG_RESULT(done) +]) + dnl dnl PHP_LIBGCC_LIBPATH(gcc) dnl Stores the location of libgcc in libgcc_libpath @@ -96,7 +126,7 @@ EOF ]) AC_DEFUN(PHP_TIME_R_TYPE,[ -AC_CACHE_CHECK(for time_r type, ac_cv_time_r_type,[ +AC_CACHE_CHECK(for *time_r type, ac_cv_time_r_type,[ AC_TRY_RUN([ #include <time.h> #include <stdlib.h> diff --git a/configure.in b/configure.in index 666c2ab18d..a69b9b1677 100644 --- a/configure.in +++ b/configure.in @@ -136,6 +136,7 @@ divert(3) PHP_CONFIGURE_PART(Running system checks) +PHP_MISSING_TIME_R_DECL dnl check for -R, etc. switch AC_MSG_CHECKING(whether compiler supports -R) diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c index f48243669c..3e4398a266 100644 --- a/ext/calendar/cal_unix.c +++ b/ext/calendar/cal_unix.c @@ -45,7 +45,7 @@ PHP_FUNCTION(unixtojd) t = time(NULL); } - ta = localtime_r(&t, &tmbuf); + ta = php_localtime_r(&t, &tmbuf); jdate = GregorianToSdn(ta->tm_year+1900, ta->tm_mon+1,ta->tm_mday); RETURN_LONG(jdate); diff --git a/ext/filepro/filepro.c b/ext/filepro/filepro.c index 04c7da31f4..dbc9a78487 100644 --- a/ext/filepro/filepro.c +++ b/ext/filepro/filepro.c @@ -223,13 +223,13 @@ PHP_FUNCTION(filepro) } /* Get the field count, assume the file is readable! */ - if (strcmp(strtok_r(readbuf, ":", &strtok_buf), "map")) { + if (strcmp(php_strtok_r(readbuf, ":", &strtok_buf), "map")) { php_error(E_WARNING, "filePro: map file corrupt or encrypted"); RETURN_FALSE; } - FP_GLOBAL(fp_keysize) = atoi(strtok_r(NULL, ":", &strtok_buf)); - strtok_r(NULL, ":", &strtok_buf); - FP_GLOBAL(fp_fcount) = atoi(strtok_r(NULL, ":", &strtok_buf)); + FP_GLOBAL(fp_keysize) = atoi(php_strtok_r(NULL, ":", &strtok_buf)); + php_strtok_r(NULL, ":", &strtok_buf); + FP_GLOBAL(fp_fcount) = atoi(php_strtok_r(NULL, ":", &strtok_buf)); /* Read in the fields themselves */ for (i = 0; i < FP_GLOBAL(fp_fcount); i++) { @@ -241,9 +241,9 @@ PHP_FUNCTION(filepro) } new_field = emalloc(sizeof(FP_FIELD)); new_field->next = NULL; - new_field->name = estrdup(strtok_r(readbuf, ":", &strtok_buf)); - new_field->width = atoi(strtok_r(NULL, ":", &strtok_buf)); - new_field->format = estrdup(strtok_r(NULL, ":", &strtok_buf)); + new_field->name = estrdup(php_strtok_r(readbuf, ":", &strtok_buf)); + new_field->width = atoi(php_strtok_r(NULL, ":", &strtok_buf)); + new_field->format = estrdup(php_strtok_r(NULL, ":", &strtok_buf)); /* Store in forward-order to save time later */ if (!FP_GLOBAL(fp_fieldlist)) { diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 1a5e807e8b..98605d1e0e 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -635,7 +635,7 @@ ftp_mdtm(ftpbuf_t *ftp, const char *path) /* figure out the GMT offset */ stamp = time(NULL); - gmt = gmtime_r(&stamp, &tmbuf); + gmt = php_gmtime_r(&stamp, &tmbuf); gmt->tm_isdst = -1; /* apply the GMT offset */ diff --git a/ext/hyperwave/hw.c b/ext/hyperwave/hw.c index cc51a92830..612b143a46 100644 --- a/ext/hyperwave/hw.c +++ b/ext/hyperwave/hw.c @@ -316,7 +316,7 @@ int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr to the return_value array. */ temp = estrdup(objrec); - attrname = strtok_r(temp, "\n", &strtok_buf); + attrname = php_strtok_r(temp, "\n", &strtok_buf); while(attrname != NULL) { zval *data, **dataptr; long spec; @@ -372,7 +372,7 @@ int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr } } - attrname = strtok_r(NULL, "\n", &strtok_buf); + attrname = php_strtok_r(NULL, "\n", &strtok_buf); } if(NULL == sarr){ // spec_arr->refcount--; @@ -413,7 +413,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { /* Fill Array of titles, descriptions and keywords */ temp = estrdup(objrec); - attrname = strtok_r(temp, "\n", &strtok_buf); + attrname = php_strtok_r(temp, "\n", &strtok_buf); while(attrname != NULL) { str = attrname; iTitle = 0; @@ -468,7 +468,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { if(iGroup) add_next_index_string(group_arr, str, 1); } - attrname = strtok_r(NULL, "\n", &strtok_buf); + attrname = php_strtok_r(NULL, "\n", &strtok_buf); } efree(temp); @@ -507,7 +507,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { /* All other attributes. Make a another copy first */ temp = estrdup(objrec); - attrname = strtok_r(temp, "\n", &strtok_buf); + attrname = php_strtok_r(temp, "\n", &strtok_buf); while(attrname != NULL) { str = attrname; /* We don't want to insert titles, descr., keywords a second time */ @@ -521,7 +521,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { str++; add_assoc_string(*return_value, attrname, str, 1); } - attrname = strtok_r(NULL, "\n", &strtok_buf); + attrname = php_strtok_r(NULL, "\n", &strtok_buf); } efree(temp); @@ -1171,7 +1171,7 @@ php_printf("%s\n", ptr); } temp = estrdup(ptr); - attrname = strtok_r(temp, "\n", &strtok_buf); + attrname = php_strtok_r(temp, "\n", &strtok_buf); i = 0; while(attrname != NULL) { char *name; @@ -1245,7 +1245,7 @@ php_printf("%s\n", ptr); /* Add the user array */ zend_hash_index_update(return_value->value.ht, i++, &user_arr, sizeof(pval), NULL); - attrname = strtok_r(NULL, "\n", &strtok_buf); + attrname = php_strtok_r(NULL, "\n", &strtok_buf); } efree(temp); efree(object); diff --git a/ext/session/session.c b/ext/session/session.c index 8525162cc1..dff780ff72 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -485,7 +485,7 @@ static void strcat_gmt(char *ubuf, time_t *when) char buf[MAX_STR]; struct tm tm; - gmtime_r(when, &tm); + php_gmtime_r(when, &tm); /* we know all components, thus it is safe to use sprintf */ sprintf(buf, "%s, %d %s %d %02d:%02d:%02d GMT", week_days[tm.tm_wday], tm.tm_mday, month_names[tm.tm_mon], tm.tm_year + 1900, tm.tm_hour, tm.tm_min, tm.tm_sec); diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index 76eaf70890..0eaeef7671 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -103,7 +103,7 @@ void php_mktime(INTERNAL_FUNCTION_PARAMETERS, int gm) ** default parameters for PHP gmmktime would be the current ** GMT time values... */ - ta = localtime_r(&t, &tmbuf); + ta = php_localtime_r(&t, &tmbuf); /* Let DST be unknown. mktime() should compute the right value ** and behave correctly. Unless the user overrides this. @@ -221,9 +221,9 @@ php_date(INTERNAL_FUNCTION_PARAMETERS, int gm) convert_to_string_ex(format); if (gm) { - ta = gmtime_r(&the_time, &tmbuf); + ta = php_gmtime_r(&the_time, &tmbuf); } else { - ta = localtime_r(&the_time, &tmbuf); + ta = php_localtime_r(&the_time, &tmbuf); } if (!ta) { /* that really shouldn't happen... */ @@ -489,7 +489,7 @@ PHP_FUNCTION(localtime) assoc_array = (*assoc_array_arg)->value.lval; break; } - ta = localtime_r(×tamp, &tmbuf); + ta = php_localtime_r(×tamp, &tmbuf); if (array_init(return_value) == FAILURE) { php_error(E_ERROR, "Cannot prepare return array from localtime"); RETURN_FALSE; @@ -536,7 +536,7 @@ PHP_FUNCTION(getdate) timestamp = (*timestamp_arg)->value.lval; } - ta = localtime_r(×tamp, &tmbuf); + ta = php_localtime_r(×tamp, &tmbuf); if (!ta) { php_error(E_WARNING, "Cannot perform date calculation"); return; @@ -566,7 +566,7 @@ char *php_std_date(time_t t) char *str; PLS_FETCH(); - tm1 = gmtime_r(&t, &tmbuf); + tm1 = php_gmtime_r(&t, &tmbuf); str = emalloc(81); if (PG(y2k_compliance)) { snprintf(str, 80, "%s, %02d %s %04d %02d:%02d:%02d GMT", @@ -658,9 +658,9 @@ void _php_strftime(INTERNAL_FUNCTION_PARAMETERS, int gm) } format = (*format_arg)->value.str.val; if (gm) { - ta = gmtime_r(×tamp, &tmbuf); + ta = php_gmtime_r(×tamp, &tmbuf); } else { - ta = localtime_r(×tamp, &tmbuf); + ta = php_localtime_r(×tamp, &tmbuf); } buf = (char *) emalloc(buf_len); diff --git a/ext/standard/info.c b/ext/standard/info.c index bc6c633433..38be6c7c17 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -136,7 +136,7 @@ PHPAPI void php_print_info(int flag) SLS_FETCH(); the_time = time(NULL); - ta = localtime_r(&the_time, &tmbuf); + ta = php_localtime_r(&the_time, &tmbuf); if (flag & PHP_INFO_GENERAL) { #ifdef PHP_WIN32 diff --git a/ext/standard/parsedate.y b/ext/standard/parsedate.y index 819af8235d..f0a5e80f8a 100644 --- a/ext/standard/parsedate.y +++ b/ext/standard/parsedate.y @@ -556,13 +556,13 @@ int GetTimeInfo(TIMEINFO *Now) /* Now get the timezone if the last time < HH:00:00 <= now for some HH. */ if (NextHour <= Now->time) { - if ((tm = localtime_r(&Now->time, &tmbuf)) == NULL) + if ((tm = php_localtime_r(&Now->time, &tmbuf)) == NULL) return -1; secondsUntilNextHour = 60 * (60 - tm->tm_min) - tm->tm_sec; #if !defined(HAVE_TM_GMTOFF) /* To get the timezone, compare localtime with GMT. */ local = *tm; - if ((tm = gmtime_r(&Now->time, &tmbuf)) == NULL) + if ((tm = php_gmtime_r(&Now->time, &tmbuf)) == NULL) return -1; gmt = *tm; @@ -661,7 +661,7 @@ Convert(time_t Month, time_t Day, time_t Year, time_t Hours, time_t Minutes, tim return -1; Julian += tod; tod = Julian; - if (dst == DSTon || (dst == DSTmaybe && localtime_r(&tod,&tmbuf)->tm_isdst)) + if (dst == DSTon || (dst == DSTmaybe && php_localtime_r(&tod,&tmbuf)->tm_isdst)) Julian -= DST_OFFSET * 60 * 60; return Julian; } @@ -674,8 +674,8 @@ DSTcorrect(time_t Start, time_t Future) time_t FutureDay; struct tm tmbuf; - StartDay = (localtime_r(&Start,&tmbuf)->tm_hour + 1) % 24; - FutureDay = (localtime_r(&Future,&tmbuf)->tm_hour + 1) % 24; + StartDay = (php_localtime_r(&Start,&tmbuf)->tm_hour + 1) % 24; + FutureDay = (php_localtime_r(&Future,&tmbuf)->tm_hour + 1) % 24; return (Future - Start) + (StartDay - FutureDay) * DST_OFFSET * 60 * 60; } @@ -687,7 +687,7 @@ RelativeMonth(time_t Start, time_t RelMonth) time_t Month; time_t Year; - tm = localtime_r(&Start, &tmbuf); + tm = php_localtime_r(&Start, &tmbuf); Month = 12 * tm->tm_year + tm->tm_mon + RelMonth; Year = Month / 12; Year += 1900; @@ -862,7 +862,7 @@ time_t parsedate(char *p, TIMEINFO *now) (void)GetTimeInfo(&ti); } - tm = localtime_r(&now->time, &tmbuf); + tm = php_localtime_r(&now->time, &tmbuf); yyYear = tm->tm_year + 1900; yyMonth = tm->tm_mon + 1; yyDay = tm->tm_mday; diff --git a/main/main.c b/main/main.c index d5867655bd..80fe5455e4 100644 --- a/main/main.c +++ b/main/main.c @@ -255,7 +255,7 @@ void php_log_err(char *log_message) log_file = V_FOPEN(PG(error_log), "a"); if (log_file != NULL) { time(&error_time); - strftime(error_time_str, 128, "%d-%b-%Y %H:%M:%S", localtime_r(&error_time, &tmbuf)); + strftime(error_time_str, 128, "%d-%b-%Y %H:%M:%S", php_localtime_r(&error_time, &tmbuf)); fprintf(log_file, "[%s] ", error_time_str); fprintf(log_file, log_message); fprintf(log_file, "\n"); @@ -626,8 +626,8 @@ static void php_message_handler_for_zend(long message, void *data) SLS_FETCH(); time(&curtime); - ta = localtime_r(&curtime, &tmbuf); - datetime_str = asctime_r(ta, asctimebuf); + ta = php_localtime_r(&curtime, &tmbuf); + datetime_str = php_asctime_r(ta, asctimebuf); datetime_str[strlen(datetime_str)-1]=0; /* get rid of the trailing newline */ fprintf(stderr, "[%s] Script: '%s'\n", datetime_str, SAFE_FILENAME(SG(request_info).path_translated)); } diff --git a/main/php_reentrancy.h b/main/php_reentrancy.h index 8b6ce5e8e1..fd76ce1339 100644 --- a/main/php_reentrancy.h +++ b/main/php_reentrancy.h @@ -42,39 +42,60 @@ #if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME) #define PHP_NEED_REENTRANCY 1 -#define localtime_r php_localtime_r -PHPAPI struct tm *localtime_r(const time_t *const timep, struct tm *p_tm); +PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm); +#else +#define php_localtime_r localtime_r +#ifdef MISSING_LOCALTIME_R_DECL +struct tm *localtime_r(const time_t *const timep, struct tm *p_tm); +#endif #endif #if !defined(HAVE_CTIME_R) && defined(HAVE_CTIME) #define PHP_NEED_REENTRANCY 1 -#define ctime_r php_ctime_r -PHPAPI char *ctime_r(const time_t *clock, char *buf); +PHPAPI char *php_ctime_r(const time_t *clock, char *buf); +#else +#define php_ctime_r ctime_r +#ifdef MISSING_CTIME_R_DECL +char *ctime_r(const time_t *clock, char *buf); +#endif #endif #if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME) #define PHP_NEED_REENTRANCY 1 -#define asctime_r php_asctime_r -PHPAPI char *asctime_r(const struct tm *tm, char *buf); +PHPAPI char *php_asctime_r(const struct tm *tm, char *buf); +#else +#define php_asctime_r asctime_r +#ifdef MISSING_ASCTIME_R_DECL +char *asctime_r(const struct tm *tm, char *buf); +#endif #endif #if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME) #define PHP_NEED_REENTRANCY 1 -#define gmtime_r php_gmtime_r -PHPAPI struct tm *gmtime_r(const time_t *const timep, struct tm *p_tm); +PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm); +#else +#define php_gmtime_r gmtime_r +#ifdef MISSING_GMTIME_R_DECL +struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm); +#endif #endif #if !defined(HAVE_STRTOK_R) -#define strtok_r php_strtok_r -PHPAPI char *strtok_r(char *s, const char *delim, char **last); +PHPAPI char *php_strtok_r(char *s, const char *delim, char **last); +#else +#define php_strtok_r strtok_r +#ifdef MISSING_STRTOK_R_DECL +char *strtok_r(char *s, const char *delim, char **last); +#endif #endif #if !defined(HAVE_RAND_R) -#define rand_r php_rand_r -PHPAPI int rand_r(unsigned int *seed); +PHPAPI int php_rand_r(unsigned int *seed); +#else +#define php_rand_r rand_r #endif #if !defined(ZTS) diff --git a/main/php_variables.c b/main/php_variables.c index 8f612b3456..0bb257cad8 100644 --- a/main/php_variables.c +++ b/main/php_variables.c @@ -192,7 +192,7 @@ SAPI_POST_HANDLER_FUNC(php_std_post_handler) ELS_FETCH(); PLS_FETCH(); - var = strtok_r(SG(request_info).post_data, "&", &strtok_buf); + var = php_strtok_r(SG(request_info).post_data, "&", &strtok_buf); while (var) { val = strchr(var, '='); @@ -203,7 +203,7 @@ SAPI_POST_HANDLER_FUNC(php_std_post_handler) php_url_decode(val, strlen(val)); php_register_variable(var, val, array_ptr ELS_CC PLS_CC); } - var = strtok_r(NULL, "&", &strtok_buf); + var = php_strtok_r(NULL, "&", &strtok_buf); } } @@ -274,11 +274,11 @@ void php_treat_data(int arg, char *str ELS_DC PLS_DC SLS_DC) } if (arg == PARSE_COOKIE) { - var = strtok_r(res, ";", &strtok_buf); + var = php_strtok_r(res, ";", &strtok_buf); } else if (arg == PARSE_POST) { - var = strtok_r(res, "&", &strtok_buf); + var = php_strtok_r(res, "&", &strtok_buf); } else { - var = strtok_r(res, PG(arg_separator), &strtok_buf); + var = php_strtok_r(res, PG(arg_separator), &strtok_buf); } while (var) { @@ -291,9 +291,9 @@ void php_treat_data(int arg, char *str ELS_DC PLS_DC SLS_DC) php_register_variable(var, val, array_ptr ELS_CC PLS_CC); } if (arg == PARSE_COOKIE) { - var = strtok_r(NULL, ";", &strtok_buf); + var = php_strtok_r(NULL, ";", &strtok_buf); } else { - var = strtok_r(NULL, PG(arg_separator), &strtok_buf); + var = php_strtok_r(NULL, PG(arg_separator), &strtok_buf); } } if (free_buffer) { diff --git a/main/reentrancy.c b/main/reentrancy.c index 2f17e56207..5f6209b2e0 100644 --- a/main/reentrancy.c +++ b/main/reentrancy.c @@ -48,33 +48,29 @@ static MUTEX_T reentrant_locks[NUMBER_OF_LOCKS]; #if defined(PHP_HPUX_TIME_R) -PHPAPI struct tm *localtime_r(const time_t *const timep, struct tm *p_tm) +PHPAPI struct tm *php_localtime_r(const time_t *const timep, struct tm *p_tm) { -#undef localtime_r if (localtime_r(timep, p_tm) == 0) return (p_tm); return (NULL); } -PHPAPI char *ctime_r(const time_t *clock, char *buf) +PHPAPI char *php_ctime_r(const time_t *clock, char *buf) { -#undef ctime_r if (ctime_r(clock, buf, 26) != -1) return (buf); return (NULL); } -PHPAPI char *asctime_r(const struct tm *tm, char *buf) +PHPAPI char *php_asctime_r(const struct tm *tm, char *buf) { -#undef asctime_r if (asctime_r(tm, buf, 26) != -1) return (buf); return (NULL); } -PHPAPI struct tm *gmtime_r(const time_t *const timep, struct tm *p_tm) +PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm) { -#undef gmtime_r if (gmtime_r(timep, p_tm) == 0) return (p_tm); return (NULL); @@ -123,7 +119,7 @@ PHPAPI char *ctime_r(const time_t *clock, char *buf) #if !defined(HAVE_ASCTIME_R) && defined(HAVE_ASCTIME) -PHPAPI char *asctime_r(const struct tm *tm, char *buf) +PHPAPI char *php_asctime_r(const struct tm *tm, char *buf) { char *tmp; @@ -141,7 +137,7 @@ PHPAPI char *asctime_r(const struct tm *tm, char *buf) #if !defined(HAVE_GMTIME_R) && defined(HAVE_GMTIME) -PHPAPI struct tm *gmtime_r(const time_t *const timep, struct tm *p_tm) +PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm) { struct tm *tmp; @@ -227,7 +223,7 @@ do_rand(unsigned long *ctx) PHPAPI int -rand_r(unsigned int *ctx) +php_rand_r(unsigned int *ctx) { u_long val = (u_long) *ctx; *ctx = do_rand(&val); @@ -285,7 +281,7 @@ rand_r(unsigned int *ctx) #include <stddef.h> PHPAPI char * -strtok_r(char *s, const char *delim, char **last) +php_strtok_r(char *s, const char *delim, char **last) { char *spanp; int c, sc; diff --git a/sapi/isapi/php4isapi.c b/sapi/isapi/php4isapi.c index 3573fe0941..db0349ca69 100644 --- a/sapi/isapi/php4isapi.c +++ b/sapi/isapi/php4isapi.c @@ -356,7 +356,7 @@ static void sapi_isapi_register_server_variables(zval *track_vars_array ELS_DC S return; } } - variable = strtok_r(variable_buf, "\r\n", &strtok_buf); + variable = php_strtok_r(variable_buf, "\r\n", &strtok_buf); while (variable) { char *colon = strchr(variable, ':'); @@ -370,7 +370,7 @@ static void sapi_isapi_register_server_variables(zval *track_vars_array ELS_DC S php_register_variable(variable, value, track_vars_array ELS_CC PLS_CC); *colon = ':'; } - variable = strtok_r(NULL, "\r\n", &strtok_buf); + variable = php_strtok_r(NULL, "\r\n", &strtok_buf); } if (variable_buf!=static_variable_buf) { efree(variable_buf); diff --git a/win32/registry.c b/win32/registry.c index 4f74374e8f..f29de501cf 100644 --- a/win32/registry.c +++ b/win32/registry.c @@ -49,7 +49,7 @@ void UpdateIniFromRegistry(char *path) } - path = p = strtok_r(path, "\\/", &strtok_buf); + path = p = php_strtok_r(path, "\\/", &strtok_buf); while (p) { HKEY hKey; @@ -73,7 +73,7 @@ void UpdateIniFromRegistry(char *path) } RegCloseKey(hKey); - p = strtok_r(NULL, "\\/", &strtok_buf); + p = php_strtok_r(NULL, "\\/", &strtok_buf); } RegCloseKey(MainKey); efree(orig_path); |