com php-src: Remove free_string_zval: Zend/zend.c Z end/zend.h Zend/zend_compile.c
| From: | Xinchen Hui | Date: | Fri, 11 Sep 2015 02:58:24 +0000 |
| Subject: | com php-src: Remove free_string_zval: Zend/zend.c Z end/zend.h Zend/zend_compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89000@lists.php.net to get a copy of this message | ||
Commit: 4ddeeb49a527963db660fb57dc5376e91f2c3772
Author: Xinchen Hui <laruence@gmail.com> Fri, 11 Sep 2015 10:58:24 +0800
Parents: 719664dec2573e9189fd2244624f0c6013197281
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4ddeeb49a527963db660fb57dc5376e91f2c3772
Log:
Remove free_string_zval
Changed paths:
M Zend/zend.c
M Zend/zend.h
M Zend/zend_compile.c
Diff:
diff --git a/Zend/zend.c b/Zend/zend.c
index c11f0d6..c521df9 100644
--- a/Zend/zend.c
+++ b/Zend/zend.c
@@ -1467,13 +1467,6 @@ void free_estring(char **str_p) /* {{{ */
}
/* }}} */
-void free_string_zval(zval *zv) /* {{{ */
-{
- zend_string *str = Z_PTR_P(zv);
- zend_string_release(str);
-}
-/* }}} */
-
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend.h b/Zend/zend.h
index de85a2c..f1fb37c 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -262,7 +262,6 @@ ZEND_API void zend_deactivate_modules(void);
ZEND_API void zend_post_deactivate_modules(void);
ZEND_API void free_estring(char **str_p);
-ZEND_API void free_string_zval(zval *zv);
END_EXTERN_C()
/* output support */
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index e63875c..1323dbc 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -319,7 +319,7 @@ void init_compiler(void) /* {{{ */
memset(&CG(context), 0, sizeof(CG(context)));
zend_init_compiler_data_structures();
zend_init_rsrc_list();
- zend_hash_init(&CG(filenames_table), 8, NULL, free_string_zval, 0);
+ zend_hash_init(&CG(filenames_table), 8, NULL, ZVAL_PTR_DTOR, 0);
zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *))
file_handle_dtor, 0);
CG(unclean_shutdown) = 0;
}
@@ -337,17 +337,19 @@ void shutdown_compiler(void) /* {{{ */
ZEND_API zend_string *zend_set_compiled_filename(zend_string *new_compiled_filename) /* {{{ */
{
- zend_string *p;
+ zval *p, rv;
- p = zend_hash_find_ptr(&CG(filenames_table), new_compiled_filename);
- if (p != NULL) {
- CG(compiled_filename) = p;
- return p;
+ if ((p = zend_hash_find(&CG(filenames_table), new_compiled_filename))) {
+ ZEND_ASSERT(Z_TYPE_P(p) == IS_STRING);
+ CG(compiled_filename) = Z_STR_P(p);
+ return Z_STR_P(p);
}
- p = zend_string_copy(new_compiled_filename);
- zend_hash_update_ptr(&CG(filenames_table), new_compiled_filename, p);
- CG(compiled_filename) = p;
- return p;
+
+ ZVAL_STR_COPY(&rv, new_compiled_filename);
+ zend_hash_update(&CG(filenames_table), new_compiled_filename, &rv);
+
+ CG(compiled_filename) = new_compiled_filename;
+ return new_compiled_filename;
}
/* }}} */