Note that there is some macro magic in http_log.h that does this
automatically on C99 compilers. There is nothing wrong with doing the
check explicitly, and it is definitely a good idea if the saved function
call is very expensive. But in general other improvements may have more
impact and therefore be a better use of your time. But of course that's
your choice ;)
On Fri, 1 Mar 2013, jaillet...@apache.org wrote:
Author: jailletc36
Date: Fri Mar 1 06:33:40 2013
New Revision: 1451478
URL: http://svn.apache.org/r1451478
Log:
Avoid some memory allocation on error path in 'http2env' if TRACE1 logging is
not activated
Avoid a function ca
Modified:
httpd/httpd/trunk/server/util_script.c
Modified: httpd/httpd/trunk/server/util_script.c
URL:
http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_script.c?rev=1451478&r1=1451477&r2=1451478&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_script.c (original)
+++ httpd/httpd/trunk/server/util_script.c Fri Mar 1 06:33:40 2013
@@ -73,9 +73,10 @@ static char *http2env(request_rec *r, co
*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_er
"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")) {