summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2015-09-11 10:58:24 +0800
committerXinchen Hui <laruence@gmail.com>2015-09-11 10:58:24 +0800
commit4ddeeb49a527963db660fb57dc5376e91f2c3772 (patch)
treed73ce0493d0afdf51f2a883c5b1e4d7e153d2122
parent719664dec2573e9189fd2244624f0c6013197281 (diff)
downloadphp-git-4ddeeb49a527963db660fb57dc5376e91f2c3772.tar.gz
Remove free_string_zval
-rw-r--r--Zend/zend.c7
-rw-r--r--Zend/zend.h1
-rw-r--r--Zend/zend_compile.c22
3 files changed, 12 insertions, 18 deletions
diff --git a/Zend/zend.c b/Zend/zend.c
index c11f0d62c5..c521df9ce2 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 de85a2c9d5..f1fb37c3f0 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 e63875cbfc..1323dbc778 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;
}
/* }}} */