From 85ed636d1d29c0625f9d8c4b1d347e3a22d4869a Mon Sep 17 00:00:00 2001 From: Christophe Jaillet Date: Fri, 1 Mar 2013 06:33:40 +0000 Subject: [PATCH] Avoid some memory allocation on error path in 'http2env' if TRACE1 logging is not activated. 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 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/server/util_script.c b/server/util_script.c index 5708c08602..2dcb06d62a 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -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")) { -- 2.49.0