This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new ce3e12e  Reverse debug specific check.
ce3e12e is described below

commit ce3e12e1be6f1f9f828f928ad1f987ef5991b553
Author: David Calavera <[email protected]>
AuthorDate: Wed Nov 6 10:24:07 2019 -0800

    Reverse debug specific check.
    
    debug_flag && diags->on() is almost an atomic operation,
    while is_debug_tag_set requires Diags to run a regular expression.
    
    When debug_flag is set to 1, we always want to print the debug log,
    regardless of whether the tag is set or not, which makes the
    is_debug_tag_set check useless, and expensive.
    
    This change flips the conditional to check if debug_flag is 1 first,
    skipping the tag check if it is.
    
    Signed-off-by: David Calavera <[email protected]>
    (cherry picked from commit 9e91efbb24eafe4150d286e1bab2a52d8bb0823c)
---
 src/traffic_server/InkAPI.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/traffic_server/InkAPI.cc b/src/traffic_server/InkAPI.cc
index 49ae843..1d9dea3 100644
--- a/src/traffic_server/InkAPI.cc
+++ b/src/traffic_server/InkAPI.cc
@@ -7447,7 +7447,7 @@ TSIsDebugTagSet(const char *t)
 void
 TSDebugSpecific(int debug_flag, const char *tag, const char *format_str, ...)
 {
-  if (is_debug_tag_set(tag) || (debug_flag && diags->on())) {
+  if ((debug_flag && diags->on()) || is_debug_tag_set(tag)) {
     va_list ap;
 
     va_start(ap, format_str);

Reply via email to