diff options
author | Dmitry Stogov <dmitry@zend.com> | 2015-03-04 02:05:28 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2015-03-04 02:05:28 +0300 |
commit | 2fa8d67a5ce59ba9ba6192481e3c2522c3ff5542 (patch) | |
tree | 9d9d57215f756c387722e74d7d1e1c2de3276a1c /ext/spl/php_spl.c | |
parent | 2841aa95db84f3563c94c90f84bf7f47ba159a2d (diff) | |
download | php-git-2fa8d67a5ce59ba9ba6192481e3c2522c3ff5542.tar.gz |
Use zend_string* instead of char* for opened_patch handling. Avoid reallocations and improve string reuse.
Diffstat (limited to 'ext/spl/php_spl.c')
-rw-r--r-- | ext/spl/php_spl.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index 9c7dc5caff..f16734422b 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -273,9 +273,9 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha if (ret == SUCCESS) { zend_string *opened_path; if (!file_handle.opened_path) { - file_handle.opened_path = estrndup(class_file, class_file_len); + file_handle.opened_path = zend_string_init(class_file, class_file_len, 0); } - opened_path = zend_string_init(file_handle.opened_path, strlen(file_handle.opened_path), 0); + opened_path = zend_string_copy(file_handle.opened_path); ZVAL_NULL(&dummy); if (zend_hash_add(&EG(included_files), opened_path, &dummy)) { new_op_array = zend_compile_file(&file_handle, ZEND_REQUIRE); |