]> granicus.if.org Git - apache/commitdiff
Avoid some memory allocation on error path in 'http2env' if TRACE1 logging is not...
authorChristophe Jaillet <jailletc36@apache.org>
Fri, 1 Mar 2013 06:33:40 +0000 (06:33 +0000)
committerChristophe Jaillet <jailletc36@apache.org>
Fri, 1 Mar 2013 06:33:40 +0000 (06:33 +0000)
Avoid a function call to 'apr_filepath_name_get' which ends up to a strrchr call, if TRACE1 logging is not activated.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1451478 13f79535-47bb-0310-9956-ffa450edef68

server/util_script.c

index 5708c0860255d5103b517b4bd6c144a24b968110..2dcb06d62a9cc88ce59d0cdc147623a6b8a6b555 100644 (file)
@@ -73,9 +73,10 @@ static char *http2env(request_rec *r, const char *w)
             *cp++ = '_';
         }
         else {
-            ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
-                          "Not exporting header with invalid name as envvar: %s",
-                          ap_escape_logitem(r->pool, w));
+            if (APLOGrtrace1(r))
+                ap_log_rerror(APLOG_MARK, APLOG_TRACE1, 0, r,
+                            "Not exporting header with invalid name as envvar: %s",
+                            ap_escape_logitem(r->pool, w));
             return NULL;
         }
     }
@@ -594,9 +595,10 @@ AP_DECLARE(int) ap_scan_script_header_err_core_ex(request_rec *r, char *buffer,
                               "Invalid status line from script '%s': %.30s",
                               apr_filepath_name_get(r->filename), l);
             else
-                ap_log_rerror(SCRIPT_LOG_MARK, APLOG_TRACE1, 0, r,
-                              "Status line from script '%s': %.30s",
-                              apr_filepath_name_get(r->filename), l);
+                if (APLOGrtrace1(r))
+                   ap_log_rerror(SCRIPT_LOG_MARK, APLOG_TRACE1, 0, r,
+                                 "Status line from script '%s': %.30s",
+                                 apr_filepath_name_get(r->filename), l);
             r->status_line = apr_pstrdup(r->pool, l);
         }
         else if (!strcasecmp(w, "Location")) {