diff options
| author | Sascha Schumann <sas@php.net> | 1999-11-26 16:51:57 +0000 |
|---|---|---|
| committer | Sascha Schumann <sas@php.net> | 1999-11-26 16:51:57 +0000 |
| commit | 2f6ded9ac9bb8826eb9b3b79b8cdc018c90aff54 (patch) | |
| tree | c47d480cc160fad7842ebee9ee96672e57e54628 /ext | |
| parent | fe48f6ed6aff5572fbb2c093690ecf9b24248b86 (diff) | |
| download | php-git-2f6ded9ac9bb8826eb9b3b79b8cdc018c90aff54.tar.gz | |
Convert more source files to use thread-safe functions
Diffstat (limited to 'ext')
| -rw-r--r-- | ext/filepro/filepro.c | 15 | ||||
| -rw-r--r-- | ext/ftp/ftp.c | 4 | ||||
| -rw-r--r-- | ext/hyperwave/hw.c | 19 | ||||
| -rw-r--r-- | ext/rpc/com/COM.c | 7 |
4 files changed, 25 insertions, 20 deletions
diff --git a/ext/filepro/filepro.c b/ext/filepro/filepro.c index 83a63e8f3e..a9b7ec3064 100644 --- a/ext/filepro/filepro.c +++ b/ext/filepro/filepro.c @@ -182,6 +182,7 @@ PHP_FUNCTION(filepro) FILE *fp; char workbuf[256]; /* FIX - should really be the max filename length */ char readbuf[256]; + char *strtok_buf = NULL; int i; FP_FIELD *new_field, *tmp; FP_TLS_VARS; @@ -221,13 +222,13 @@ PHP_FUNCTION(filepro) } /* Get the field count, assume the file is readable! */ - if (strcmp(strtok(readbuf, ":"), "map")) { + if (strcmp(strtok_r(readbuf, ":", &strtok_buf), "map")) { php_error(E_WARNING, "filePro: map file corrupt or encrypted"); RETURN_FALSE; } - FP_GLOBAL(fp_keysize) = atoi(strtok(NULL, ":")); - strtok(NULL, ":"); - FP_GLOBAL(fp_fcount) = atoi(strtok(NULL, ":")); + 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)); /* Read in the fields themselves */ for (i = 0; i < FP_GLOBAL(fp_fcount); i++) { @@ -239,9 +240,9 @@ PHP_FUNCTION(filepro) } new_field = emalloc(sizeof(FP_FIELD)); new_field->next = NULL; - new_field->name = estrdup(strtok(readbuf, ":")); - new_field->width = atoi(strtok(NULL, ":")); - new_field->format = estrdup(strtok(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)); /* 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 47131efa31..0e39e89cf5 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -609,7 +609,7 @@ time_t ftp_mdtm(ftpbuf_t *ftp, const char *path) { time_t stamp; - struct tm *gmt; + struct tm *gmt, tmbuf; struct tm tm; char *ptr; int n; @@ -635,7 +635,7 @@ ftp_mdtm(ftpbuf_t *ftp, const char *path) /* figure out the GMT offset */ stamp = time(NULL); - gmt = gmtime(&stamp); + gmt = 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 87925916c7..be4f3adbb5 100644 --- a/ext/hyperwave/hw.c +++ b/ext/hyperwave/hw.c @@ -285,6 +285,7 @@ int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr char *attrname, *str, *temp, language[3]; int i, count; zval *spec_arr; + char *strtok_buf = NULL; /* Create an array with an entry containing specs for each attribute and fill in the specs for Title, Description, Keyword, Group. @@ -314,7 +315,7 @@ int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr to the return_value array. */ temp = estrdup(objrec); - attrname = strtok(temp, "\n"); + attrname = strtok_r(temp, "\n", &strtok_buf); while(attrname != NULL) { zval *data, **dataptr; long spec; @@ -370,7 +371,7 @@ int make2_return_array_from_objrec(pval **return_value, char *objrec, zval *sarr } } - attrname = strtok(NULL, "\n"); + attrname = strtok_r(NULL, "\n", &strtok_buf); } if(NULL == sarr){ // spec_arr->refcount--; @@ -395,6 +396,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { int hasDescription = 0; int hasKeyword = 0; int hasGroup = 0; + char *strtok_buf; MAKE_STD_ZVAL(title_arr); MAKE_STD_ZVAL(desc_arr); @@ -410,7 +412,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { /* Fill Array of titles, descriptions and keywords */ temp = estrdup(objrec); - attrname = strtok(temp, "\n"); + attrname = strtok_r(temp, "\n", &strtok_buf); while(attrname != NULL) { str = attrname; iTitle = 0; @@ -465,7 +467,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { if(iGroup) add_next_index_string(group_arr, str, 1); } - attrname = strtok(NULL, "\n"); + attrname = strtok_r(NULL, "\n", &strtok_buf); } efree(temp); @@ -504,7 +506,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(temp, "\n"); + attrname = strtok_r(temp, "\n", &strtok_buf); while(attrname != NULL) { str = attrname; /* We don't want to insert titles, descr., keywords a second time */ @@ -518,7 +520,7 @@ int make_return_array_from_objrec(pval **return_value, char *objrec) { str++; add_assoc_string(*return_value, attrname, str, 1); } - attrname = strtok(NULL, "\n"); + attrname = strtok_r(NULL, "\n", &strtok_buf); } efree(temp); @@ -1140,6 +1142,7 @@ PHP_FUNCTION(hw_who) { zval *user_arr; char *object, *ptr, *temp, *attrname; int i; + char *strtok_buf; object = php3_hw_command(INTERNAL_FUNCTION_PARAM_PASSTHRU, WHO_COMMAND); if(object == NULL) @@ -1167,7 +1170,7 @@ php_printf("%s\n", ptr); } temp = estrdup(ptr); - attrname = strtok(temp, "\n"); + attrname = strtok_r(temp, "\n", &strtok_buf); i = 0; while(attrname != NULL) { char *name; @@ -1241,7 +1244,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(NULL, "\n"); + attrname = strtok_r(NULL, "\n", &strtok_buf); } efree(temp); efree(object); diff --git a/ext/rpc/com/COM.c b/ext/rpc/com/COM.c index 5bc41c10c8..a818eb1576 100644 --- a/ext/rpc/com/COM.c +++ b/ext/rpc/com/COM.c @@ -150,6 +150,7 @@ static PHP_INI_MH(OnTypelibFileChange) { FILE *typelib_file; char *typelib_name_buffer; + char *strtok_buf = NULL; #if SUPPORT_INTERACTIVE int interactive; ELS_FETCH(); @@ -179,9 +180,9 @@ static PHP_INI_MH(OnTypelibFileChange) if (typelib_name_buffer[0]==';') { continue; } - typelib_name = strtok(typelib_name_buffer, "\r\n"); /* get rid of newlines */ - typelib_name = strtok(typelib_name, "#"); - modifier = strtok(NULL, "#"); + typelib_name = strtok_r(typelib_name_buffer, "\r\n", &strtok_buf); /* get rid of newlines */ + typelib_name = strtok_r(typelib_name, "#", &strtok_buf); + modifier = strtok_r(NULL, "#", &strtok_buf); if (modifier) { if (!strcmp(modifier, "cis") || !strcmp(modifier, "case_insensitive")) { mode &= ~CONST_CS; |
