Skip to content

Commit 4ddeeb4

Browse files
committed
Remove free_string_zval
1 parent 719664d commit 4ddeeb4

File tree

3 files changed

+12
-18
lines changed

3 files changed

+12
-18
lines changed

Zend/zend.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,13 +1467,6 @@ void free_estring(char **str_p) /* {{{ */
14671467
}
14681468
/* }}} */
14691469

1470-
void free_string_zval(zval *zv) /* {{{ */
1471-
{
1472-
zend_string *str = Z_PTR_P(zv);
1473-
zend_string_release(str);
1474-
}
1475-
/* }}} */
1476-
14771470
/*
14781471
* Local variables:
14791472
* tab-width: 4

Zend/zend.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ ZEND_API void zend_deactivate_modules(void);
262262
ZEND_API void zend_post_deactivate_modules(void);
263263

264264
ZEND_API void free_estring(char **str_p);
265-
ZEND_API void free_string_zval(zval *zv);
266265
END_EXTERN_C()
267266

268267
/* output support */

Zend/zend_compile.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ void init_compiler(void) /* {{{ */
319319
memset(&CG(context), 0, sizeof(CG(context)));
320320
zend_init_compiler_data_structures();
321321
zend_init_rsrc_list();
322-
zend_hash_init(&CG(filenames_table), 8, NULL, free_string_zval, 0);
322+
zend_hash_init(&CG(filenames_table), 8, NULL, ZVAL_PTR_DTOR, 0);
323323
zend_llist_init(&CG(open_files), sizeof(zend_file_handle), (void (*)(void *)) file_handle_dtor, 0);
324324
CG(unclean_shutdown) = 0;
325325
}
@@ -337,17 +337,19 @@ void shutdown_compiler(void) /* {{{ */
337337

338338
ZEND_API zend_string *zend_set_compiled_filename(zend_string *new_compiled_filename) /* {{{ */
339339
{
340-
zend_string *p;
340+
zval *p, rv;
341341

342-
p = zend_hash_find_ptr(&CG(filenames_table), new_compiled_filename);
343-
if (p != NULL) {
344-
CG(compiled_filename) = p;
345-
return p;
342+
if ((p = zend_hash_find(&CG(filenames_table), new_compiled_filename))) {
343+
ZEND_ASSERT(Z_TYPE_P(p) == IS_STRING);
344+
CG(compiled_filename) = Z_STR_P(p);
345+
return Z_STR_P(p);
346346
}
347-
p = zend_string_copy(new_compiled_filename);
348-
zend_hash_update_ptr(&CG(filenames_table), new_compiled_filename, p);
349-
CG(compiled_filename) = p;
350-
return p;
347+
348+
ZVAL_STR_COPY(&rv, new_compiled_filename);
349+
zend_hash_update(&CG(filenames_table), new_compiled_filename, &rv);
350+
351+
CG(compiled_filename) = new_compiled_filename;
352+
return new_compiled_filename;
351353
}
352354
/* }}} */
353355

0 commit comments

Comments
 (0)