]> granicus.if.org Git - php/commitdiff
Fixed bug #22308 (optimized passthru, code is now ~40 times faster).
authorIlia Alshanetsky <iliaa@php.net>
Thu, 20 Feb 2003 00:32:51 +0000 (00:32 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 20 Feb 2003 00:32:51 +0000 (00:32 +0000)
ext/standard/exec.c
ext/standard/http_fopen_wrapper.c

index 2605a87c9b49da9fd5c7aed3137b35f10239b203..e38069ab728a37c7a69a990534da8cc0780ff6a2 100644 (file)
@@ -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);
+                       }
                }
        }
 
index e6da65788277436cd45ca61671b02edb8d2a3e14..d869d17099d55dc62e1c114efa3c5659fc87beb2 100644 (file)
@@ -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 {