Use interned strings for stream transports

This commit is contained in:
Dmitry Stogov 2017-11-01 02:39:09 +03:00
parent ed5b4d5c99
commit 8897c80956
2 changed files with 8 additions and 1 deletions

View File

@ -695,6 +695,13 @@ static void accel_copy_permanent_strings(zend_new_interned_string_func_t new_int
p->key = new_interned_string(p->key);
}
} ZEND_HASH_FOREACH_END();
ht = php_stream_xport_get_hash();
ZEND_HASH_FOREACH_BUCKET(ht, p) {
if (p->key) {
p->key = new_interned_string(p->key);
}
} ZEND_HASH_FOREACH_END();
}
static zend_string *accel_replace_string_by_shm_permanent(zend_string *str)

View File

@ -31,7 +31,7 @@ PHPAPI HashTable *php_stream_xport_get_hash(void)
PHPAPI int php_stream_xport_register(const char *protocol, php_stream_transport_factory factory)
{
return zend_hash_str_update_ptr(&xport_hash, protocol, strlen(protocol), factory) ? SUCCESS : FAILURE;
return zend_hash_update_ptr(&xport_hash, zend_string_init_interned(protocol, strlen(protocol), 1), factory) ? SUCCESS : FAILURE;
}
PHPAPI int php_stream_xport_unregister(const char *protocol)