com php-src: Small performance improvement. The current code is correct, but if it is used inside a long loop or long strings, it's inefficient.:
main/rfc1867.c
| From: | Xinchen Hui | Date: | Tue, 03 Apr 2012 01:54:57 +0000 |
| Subject: | com php-src: Small performance improvement. The current code is correct, but if it is used inside a long loop or long strings, it's inefficient.: main/rfc1867.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-68644@lists.php.net to get a copy of this message | ||
Commit: 16bd11062ec87b1478321c964d5739a9887b8ae0
Author: Klaus Silveira <contact@klaussilveira.com> Mon, 2 Apr 2012 22:54:57 -0300
Parents: 14f120dbd9caf25704f4d4f3c9b36729d954c6e5
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=16bd11062ec87b1478321c964d5739a9887b8ae0
Log:
Small performance improvement. The current code is correct, but if it is used inside a long loop or
long strings, it's inefficient.
Changed paths:
M main/rfc1867.c
Diff:
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 5da3a99...3ca2c11 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -408,7 +408,7 @@ static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header T
/* get lines of text, or CRLF_CRLF */
- while( (line = get_line(self TSRMLS_CC)) && strlen(line) > 0 )
+ while( (line = get_line(self TSRMLS_CC)) && line[0] != '\0' )
{
/* add header to table */
char *key = line;
@@ -979,7 +979,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
continue;
}
- if (strlen(filename) == 0) {
+ if (filename[0] == '\0') {
#if DEBUG_FILE_UPLOAD
sapi_module.sapi_error(E_NOTICE, "No file uploaded");
#endif
@@ -1063,12 +1063,12 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
if (!cancel_upload && !end) {
#if DEBUG_FILE_UPLOAD
- sapi_module.sapi_error(E_NOTICE, "Missing mime boundary at the end of the data for file
%s", strlen(filename) > 0 ? filename : "");
+ sapi_module.sapi_error(E_NOTICE, "Missing mime boundary at the end of the data for file
%s", filename[0] != '\0' ? filename : "");
#endif
cancel_upload = UPLOAD_ERROR_C;
}
#if DEBUG_FILE_UPLOAD
- if (strlen(filename) > 0 && total_bytes == 0 && !cancel_upload) {
+ if (filename[0] != '\0' && total_bytes == 0 && !cancel_upload) {
sapi_module.sapi_error(E_WARNING, "Uploaded file size 0 - file [%s=%s] not saved",
param, filename);
cancel_upload = 5;
}