diff options
author | Greg Beaver <cellog@php.net> | 2008-08-31 06:47:38 +0000 |
---|---|---|
committer | Greg Beaver <cellog@php.net> | 2008-08-31 06:47:38 +0000 |
commit | eec1cf5f0a57e7b93a6b3827e3efd387873f11eb (patch) | |
tree | 7e86b8545b102033648423c1607a6ee33e64ccae /ext/phar/stream.c | |
parent | e30bf5af3b62e64015237646b8f6641f6629f9c9 (diff) | |
download | php-git-eec1cf5f0a57e7b93a6b3827e3efd387873f11eb.tar.gz |
merge from pecl/phar strlen optimizations
Diffstat (limited to 'ext/phar/stream.c')
-rw-r--r-- | ext/phar/stream.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/phar/stream.c b/ext/phar/stream.c index e6408ff669..5ec6e2a86d 100644 --- a/ext/phar/stream.c +++ b/ext/phar/stream.c @@ -676,6 +676,7 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int optio { php_url *resource; char *internal_file, *error; + int internal_file_len; phar_entry_data *idata; phar_archive_data **pphar; uint host_len; @@ -701,7 +702,7 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int optio host_len = strlen(resource->host); phar_request_initialize(TSRMLS_C); - if (FAILURE == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), resource->host, strlen(resource->host), (void **) &pphar)) { + if (FAILURE == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), resource->host, host_len, (void **) &pphar)) { pphar = NULL; } if (PHAR_G(readonly) && (!pphar || !(*pphar)->is_data)) { @@ -712,7 +713,8 @@ static int phar_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int optio /* need to copy to strip leading "/", will get touched again */ internal_file = estrdup(resource->path + 1); - if (FAILURE == phar_get_entry_data(&idata, resource->host, strlen(resource->host), internal_file, strlen(internal_file), "r", 0, &error, 1 TSRMLS_CC)) { + internal_file_len = strlen(internal_file); + if (FAILURE == phar_get_entry_data(&idata, resource->host, host_len, internal_file, internal_file_len, "r", 0, &error, 1 TSRMLS_CC)) { /* constraints of fp refcount were not met */ if (error) { php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "unlink of \"%s\" failed: %s", url, error); @@ -829,7 +831,7 @@ static int phar_wrapper_rename(php_stream_wrapper *wrapper, char *url_from, char host_len = strlen(resource_from->host); - if (SUCCESS != phar_get_archive(&phar, resource_from->host, strlen(resource_from->host), NULL, 0, &error TSRMLS_CC)) { + if (SUCCESS != phar_get_archive(&phar, resource_from->host, host_len, NULL, 0, &error TSRMLS_CC)) { php_url_free(resource_from); php_url_free(resource_to); php_error_docref(NULL TSRMLS_CC, E_WARNING, "phar error: cannot rename \"%s\" to \"%s\": %s", url_from, url_to, error); |