]> granicus.if.org Git - php/commitdiff
Remove free_string_zval
authorXinchen Hui <laruence@gmail.com>
Fri, 11 Sep 2015 02:58:24 +0000 (10:58 +0800)
committerXinchen Hui <laruence@gmail.com>
Fri, 11 Sep 2015 02:58:24 +0000 (10:58 +0800)
Zend/zend.c
Zend/zend.h
Zend/zend_compile.c

index c11f0d62c56c5b336681050f5b51461a65bf3d20..c521df9ce2cc8d67d9e5425efb5f99e3886f457b 100644 (file)
@@ -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
index de85a2c9d592676386c5fbb12b4daad85e778c02..f1fb37c3f05ee199bb9096488ce833663bb7d3a5 100644 (file)
@@ -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 */
index e63875cbfc378edccd6d4dab0c59433985a011ea..1323dbc7785af6f0297a282a4786d896b218ed87 100644 (file)
@@ -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;
 }
 /* }}} */