summaryrefslogtreecommitdiff
path: root/main/streams/streams.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-10-31 18:51:35 +0300
committerDmitry Stogov <dmitry@zend.com>2017-10-31 18:51:35 +0300
commitbbfd0df9d3903f1a5faa301e553de92372d70f03 (patch)
tree597ea731ee50ebe268d67e59425c2ef333831365 /main/streams/streams.c
parent5b044aacbeb481a840da9f9733dacfc3e0bf5cb7 (diff)
downloadphp-git-bbfd0df9d3903f1a5faa301e553de92372d70f03.tar.gz
Use interned strings for persistent stream wrappers and filters
Diffstat (limited to 'main/streams/streams.c')
-rw-r--r--main/streams/streams.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/main/streams/streams.c b/main/streams/streams.c
index 15cecff377..7f130fcb15 100644
--- a/main/streams/streams.c
+++ b/main/streams/streams.c
@@ -1691,11 +1691,9 @@ static void clone_wrapper_hash(void)
}
/* API for registering VOLATILE wrappers */
-PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_stream_wrapper *wrapper)
+PHPAPI int php_register_url_stream_wrapper_volatile(zend_string *protocol, php_stream_wrapper *wrapper)
{
- unsigned int protocol_len = (unsigned int)strlen(protocol);
-
- if (php_stream_wrapper_scheme_validate(protocol, protocol_len) == FAILURE) {
+ if (php_stream_wrapper_scheme_validate(ZSTR_VAL(protocol), ZSTR_LEN(protocol)) == FAILURE) {
return FAILURE;
}
@@ -1703,16 +1701,16 @@ PHPAPI int php_register_url_stream_wrapper_volatile(const char *protocol, php_st
clone_wrapper_hash();
}
- return zend_hash_str_add_ptr(FG(stream_wrappers), protocol, protocol_len, wrapper) ? SUCCESS : FAILURE;
+ return zend_hash_add_ptr(FG(stream_wrappers), protocol, wrapper) ? SUCCESS : FAILURE;
}
-PHPAPI int php_unregister_url_stream_wrapper_volatile(const char *protocol)
+PHPAPI int php_unregister_url_stream_wrapper_volatile(zend_string *protocol)
{
if (!FG(stream_wrappers)) {
clone_wrapper_hash();
}
- return zend_hash_str_del(FG(stream_wrappers), protocol, strlen(protocol));
+ return zend_hash_del(FG(stream_wrappers), protocol);
}
/* }}} */