]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mod_log_config.c: Use iovecs to write the log line to eliminate a memcpy
authorPaul Querna <pquerna@apache.org>
Sun, 5 Dec 2004 07:05:23 +0000 (07:05 +0000)
committerPaul Querna <pquerna@apache.org>
Sun, 5 Dec 2004 07:05:23 +0000 (07:05 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@109866 13f79535-47bb-0310-9956-ffa450edef68

modules/loggers/mod_log_config.c

index 96df3fa4347d0810e43527233694fe8c969081cd..95c79e0e8aaa1d8d323cb4d5a62c0a547ab0b99d 100644 (file)
@@ -1343,19 +1343,18 @@ static apr_status_t ap_default_log_writer( request_rec *r,
                            apr_size_t len)
 
 {
-    char *str;
-    char *s;
     int i;
     apr_status_t rv;
+    struct iovec *vec;
 
-    str = apr_palloc(r->pool, len + 1);
+    vec = apr_palloc(r->pool, nelts * sizeof(struct iovec));
 
-    for (i = 0, s = str; i < nelts; ++i) {
-        memcpy(s, strs[i], strl[i]);
-        s += strl[i];
+    for (i = 0; i < nelts; ++i) {
+        vec[i].iov_base = strs[i];
+        vec[i].iov_len = strl[i];
     }
 
-    rv = apr_file_write((apr_file_t*)handle, str, &len);
+    rv = apr_file_writev((apr_file_t*)handle, vec, nelts, &i);
 
     return rv;
 }