From: Ruediger Pluem Date: Wed, 4 Jan 2023 11:30:19 +0000 (+0000) Subject: * Optimize code flow X-Git-Tag: 2.5.0-alpha2-ci-test-only~173 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0e92ce99ce1489b9a3a7b9e47ecdff48be8f600;p=thirdparty%2Fapache%2Fhttpd.git * Optimize code flow This whole code is only needed if have a loglevel of at least DEBUG. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1906379 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/core.c b/server/core.c index 5653b4db3e6..13c60e8ca1f 100644 --- a/server/core.c +++ b/server/core.c @@ -4080,24 +4080,26 @@ static const char *set_recursion_limit(cmd_parms *cmd, void *dummy, static void log_backtrace(const request_rec *r) { - const request_rec *top = r; - - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00121) - "r->uri = %s", r->uri ? r->uri : "(unexpectedly NULL)"); - - while (top && (top->prev || top->main)) { - if (top->prev) { - top = top->prev; - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00122) - "redirected from r->uri = %s", - top->uri ? top->uri : "(unexpectedly NULL)"); - } + if (APLOGrdebug(r)) { + const request_rec *top = r; + + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00121) + "r->uri = %s", r->uri ? r->uri : "(unexpectedly NULL)"); + + while (top && (top->prev || top->main)) { + if (top->prev) { + top = top->prev; + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00122) + "redirected from r->uri = %s", + top->uri ? top->uri : "(unexpectedly NULL)"); + } - if (!top->prev && top->main) { - top = top->main; - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00123) - "subrequested from r->uri = %s", - top->uri ? top->uri : "(unexpectedly NULL)"); + if (!top->prev && top->main) { + top = top->main; + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(00123) + "subrequested from r->uri = %s", + top->uri ? top->uri : "(unexpectedly NULL)"); + } } } }