mirror of
https://github.com/phpv8/v8js.git
synced 2025-03-11 21:08:45 +00:00
Use an non-interned zend_string for registerExtension on ZTS
(There are no interned strings in ZTS, see the definition of zend_new_interned_string_int) On NTS, strings must be non-interned in order to last until module shutdown. interned strings are cleaned up before module shutdown.
This commit is contained in:
parent
3e862b1aa1
commit
efad52d739
@ -270,6 +270,7 @@ static void v8js_jsext_free_storage(v8js_jsext *jsext) /* {{{ */
|
||||
v8js_free_ext_strarr(jsext->deps, jsext->deps_count);
|
||||
}
|
||||
delete jsext->extension;
|
||||
// Free the persisted non-interned strings we allocated.
|
||||
zend_string_release(jsext->name);
|
||||
zend_string_release(jsext->source);
|
||||
|
||||
@ -959,8 +960,10 @@ static int v8js_register_extension(zend_string *name, zend_string *source, zval
|
||||
}
|
||||
|
||||
jsext->auto_enable = auto_enable;
|
||||
jsext->name = zend_string_dup(name, 1);
|
||||
jsext->source = zend_string_dup(source, 1);
|
||||
// Allocate a persistent string which will survive until module shutdown on both ZTS(Persistent) and NTS(Not interned, those would be cleaned up)
|
||||
// (zend_string_dup would return the original interned string, if interned, so we don't use that)
|
||||
jsext->name = zend_string_init(ZSTR_VAL(name), ZSTR_LEN(name), 1);
|
||||
jsext->source = zend_string_init(ZSTR_VAL(source), ZSTR_LEN(source), 1);
|
||||
|
||||
if (jsext->deps) {
|
||||
jsext->deps_ht = (HashTable *) malloc(sizeof(HashTable));
|
||||
|
Loading…
x
Reference in New Issue
Block a user