]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* Optimize code flow
authorRuediger Pluem <rpluem@apache.org>
Wed, 4 Jan 2023 11:30:19 +0000 (11:30 +0000)
committerRuediger Pluem <rpluem@apache.org>
Wed, 4 Jan 2023 11:30:19 +0000 (11:30 +0000)
  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

server/core.c

index 5653b4db3e606ea10957f2ac9217e3a6fba2c589..13c60e8ca1f85fd7b3830bb82a0030522cd6e995 100644 (file)
@@ -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)");
+            }
         }
     }
 }