cvs: php4 /ext/standard basic_functions.c basic_functions.h string.c

From: Date: Fri, 03 Aug 2001 09:50:39 +0000
Subject: cvs: php4 /ext/standard basic_functions.c basic_functions.h string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-6507@lists.php.net to get a copy of this message
sas Fri Aug 3 05:50:39 2001 EDT Modified files: /php4/ext/standard basic_functions.c basic_functions.h string.c Log: Don't copy the strtok parameter Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.374 php4/ext/standard/basic_functions.c:1.375 --- php4/ext/standard/basic_functions.c:1.374 Fri Aug 3 04:49:19 2001 +++ php4/ext/standard/basic_functions.c Fri Aug 3 05:50:38 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.374 2001/08/03 08:49:19 sas Exp $ */ +/* $Id: basic_functions.c,v 1.375 2001/08/03 09:50:38 sas Exp $ */ #include "php.h" #include "php_main.h" @@ -849,6 +849,7 @@ { memset(BG(strtok_table), 0, 256); BG(strtok_string) = NULL; + BG(strtok_zval) = NULL; BG(locale_string) = NULL; BG(user_compare_func_name) = NULL; BG(array_walk_func_name) = NULL; @@ -892,8 +893,10 @@ PHP_RSHUTDOWN_FUNCTION(basic) { - STR_FREE(BG(strtok_string)); + if (BG(strtok_zval)) + zval_ptr_dtor(BG(strtok_zval)); BG(strtok_string) = NULL; + BG(strtok_zval) = NULL; #ifdef HAVE_PUTENV zend_hash_destroy(&BG(putenv_ht)); #endif Index: php4/ext/standard/basic_functions.h diff -u php4/ext/standard/basic_functions.h:1.85 php4/ext/standard/basic_functions.h:1.86 --- php4/ext/standard/basic_functions.h:1.85 Fri Aug 3 04:49:19 2001 +++ php4/ext/standard/basic_functions.h Fri Aug 3 05:50:38 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.h,v 1.85 2001/08/03 08:49:19 sas Exp $ */ +/* $Id: basic_functions.h,v 1.86 2001/08/03 09:50:38 sas Exp $ */ #ifndef BASIC_FUNCTIONS_H #define BASIC_FUNCTIONS_H @@ -141,6 +141,7 @@ typedef struct { HashTable *user_shutdown_function_names; HashTable putenv_ht; + zval **strtok_zval; char *strtok_string; char *locale_string; char *strtok_last; Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.212 php4/ext/standard/string.c:1.213 --- php4/ext/standard/string.c:1.212 Fri Aug 3 04:49:19 2001 +++ php4/ext/standard/string.c Fri Aug 3 05:50:38 2001 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.212 2001/08/03 08:49:19 sas Exp $ */ +/* $Id: string.c,v 1.213 2001/08/03 09:50:38 sas Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -829,8 +829,12 @@ tok = args[1]; convert_to_string_ex(str); - STR_FREE(BG(strtok_string)); - BG(strtok_last) = BG(strtok_string) = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str)); + zval_add_ref(str); + if (BG(strtok_zval)) + zval_ptr_dtor(BG(strtok_zval)); + BG(strtok_zval) = str; + + BG(strtok_last) = BG(strtok_string) = Z_STRVAL_PP(str); BG(strtok_len) = Z_STRLEN_PP(str); break; }

« previous php.cvs (#6507) next »