mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Split destructor
This commit is contained in:
parent
df243f19be
commit
e3d35b6434
1 changed files with 11 additions and 2 deletions
|
@ -143,7 +143,16 @@ static void php_free_pcre_cache(zval *data) /* {{{ */
|
|||
pcre_cache_entry *pce = (pcre_cache_entry *) Z_PTR_P(data);
|
||||
if (!pce) return;
|
||||
pcre2_code_free(pce->re);
|
||||
pefree(pce, !PCRE_G(per_request_cache));
|
||||
free(pce);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
static void php_efree_pcre_cache(zval *data) /* {{{ */
|
||||
{
|
||||
pcre_cache_entry *pce = (pcre_cache_entry *) Z_PTR_P(data);
|
||||
if (!pce) return;
|
||||
pcre2_code_free(pce->re);
|
||||
efree(pce);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -459,7 +468,7 @@ static PHP_RINIT_FUNCTION(pcre)
|
|||
#endif
|
||||
|
||||
if (PCRE_G(per_request_cache)) {
|
||||
zend_hash_init(&PCRE_G(pcre_cache), 0, NULL, php_free_pcre_cache, 0);
|
||||
zend_hash_init(&PCRE_G(pcre_cache), 0, NULL, php_efree_pcre_cache, 0);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue