com php-src: Save some more calls to strlen() on the CURLFile helper methods: ext/curl/curl_file.c

From: Date: Thu, 20 Oct 2016 14:03:46 +0000
Subject: com php-src: Save some more calls to strlen() on the CURLFile helper methods: ext/curl/curl_file.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-95252@lists.php.net to get a copy of this message
Commit: 54454f73354812aaa157948ca5e829f9dac337a3 Author: Kalle Sommer Nielsen <kalle@php.net> Thu, 20 Oct 2016 16:03:46 +0200 Parents: c0d4e72a684a1ceb69ad5e28dfdf2e0694055c93 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=54454f73354812aaa157948ca5e829f9dac337a3 Log: Save some more calls to strlen() on the CURLFile helper methods Changed paths: M ext/curl/curl_file..c Diff: diff --git a/ext/curl/curl_file.c b/ext/curl/curl_file.c index ba8a7de..10a5ae5 100644 --- a/ext/curl/curl_file.c +++ b/ext/curl/curl_file.c @@ -70,19 +70,19 @@ PHP_FUNCTION(curl_file_create) } /* }}} */ -static void curlfile_get_property(char *name, INTERNAL_FUNCTION_PARAMETERS) +static void curlfile_get_property(char *name, size_t name_len, INTERNAL_FUNCTION_PARAMETERS) { zval *res, rv; if (zend_parse_parameters_none() == FAILURE) { return; } - res = zend_read_property(curl_CURLFile_class, getThis(), name, strlen(name), 1, &rv); + res = zend_read_property(curl_CURLFile_class, getThis(), name, name_len, 1, &rv); ZVAL_DEREF(res); ZVAL_COPY(return_value, res); } -static void curlfile_set_property(char *name, INTERNAL_FUNCTION_PARAMETERS) +static void curlfile_set_property(char *name, size_t name_len, INTERNAL_FUNCTION_PARAMETERS) { char *arg = NULL; size_t arg_len; @@ -90,14 +90,14 @@ static void curlfile_set_property(char *name, INTERNAL_FUNCTION_PARAMETERS) if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &arg, &arg_len) == FAILURE) { return; } - zend_update_property_string(curl_CURLFile_class, getThis(), name, strlen(name), arg); + zend_update_property_string(curl_CURLFile_class, getThis(), name, name_len, arg); } /* {{{ proto string CURLFile::getFilename() Get file name */ ZEND_METHOD(CURLFile, getFilename) { - curlfile_get_property("name", INTERNAL_FUNCTION_PARAM_PASSTHRU); + curlfile_get_property("name", sizeof("name")-1, INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */ @@ -105,7 +105,7 @@ ZEND_METHOD(CURLFile, getFilename) Get MIME type */ ZEND_METHOD(CURLFile, getMimeType) { - curlfile_get_property("mime", INTERNAL_FUNCTION_PARAM_PASSTHRU); + curlfile_get_property("mime", sizeof("mime")-1, INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */ @@ -113,7 +113,7 @@ ZEND_METHOD(CURLFile, getMimeType) Get file name for POST */ ZEND_METHOD(CURLFile, getPostFilename) { - curlfile_get_property("postname", INTERNAL_FUNCTION_PARAM_PASSTHRU); + curlfile_get_property("postname", sizeof("postname")-1, INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */ @@ -121,7 +121,7 @@ ZEND_METHOD(CURLFile, getPostFilename) Set MIME type */ ZEND_METHOD(CURLFile, setMimeType) { - curlfile_set_property("mime", INTERNAL_FUNCTION_PARAM_PASSTHRU); + curlfile_set_property("mime", sizeof("mime")-1, INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */ @@ -129,7 +129,7 @@ ZEND_METHOD(CURLFile, setMimeType) Set file name for POST */ ZEND_METHOD(CURLFile, setPostFilename) { - curlfile_set_property("postname", INTERNAL_FUNCTION_PARAM_PASSTHRU); + curlfile_set_property("postname", sizeof("postname")-1, INTERNAL_FUNCTION_PARAM_PASSTHRU); } /* }}} */

« previous php.cvs (#95252) next »