From: Ilia Alshanetsky Date: Thu, 20 Feb 2003 00:32:51 +0000 (+0000) Subject: Fixed bug #22308 (optimized passthru, code is now ~40 times faster). X-Git-Tag: RELEASE_0_5~860 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3bff5c0419ac89b9be7ccc2c67506f932521f55d;p=php Fixed bug #22308 (optimized passthru, code is now ~40 times faster). --- diff --git a/ext/standard/exec.c b/ext/standard/exec.c index 2605a87c9b..e38069ab72 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -211,11 +211,12 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value TSRMLS_DC) RETVAL_STRINGL(buf, l, 1); } } else { - int b, i; + size_t b; - while ((b = fread(buf, 1, buflen, fp)) > 0) { - for (i = 0; i < b; i++) - if (output) (void)PUTC(buf[i]); + while ((b = fread(buf, buflen, 1, fp)) > 0) { + if (output) { + PHPWRITE(buf, b); + } } } diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index e6da657882..d869d17099 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -354,7 +354,7 @@ php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, char *path, ch s = resource->path; *s = '/'; } - s[1] = '\0'; + *(s + 1) = '\0'; if (resource->path && *(resource->path) == '/' && *(resource->path + 1) == '\0') { snprintf(loc_path, sizeof(loc_path) - 1, "%s%s", resource->path, location); } else {