You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2010/09/24 19:24:02 UTC

svn commit: r1000985 - /trafficserver/traffic/trunk/iocore/cache/Cache.cc

Author: zwoop
Date: Fri Sep 24 17:24:02 2010
New Revision: 1000985

URL: http://svn.apache.org/viewvc?rev=1000985&view=rev
Log:
TS-459 Make snprintf() around Debug statements conditional.

Modified:
    trafficserver/traffic/trunk/iocore/cache/Cache.cc

Modified: trafficserver/traffic/trunk/iocore/cache/Cache.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/iocore/cache/Cache.cc?rev=1000985&r1=1000984&r2=1000985&view=diff
==============================================================================
--- trafficserver/traffic/trunk/iocore/cache/Cache.cc (original)
+++ trafficserver/traffic/trunk/iocore/cache/Cache.cc Fri Sep 24 17:24:02 2010
@@ -2515,17 +2515,21 @@ Cache::key_to_part(CacheKey *key, char *
     if (res.record) {
       unsigned short *host_hash_table = res.record->part_hash_table;
       if (host_hash_table) {
-        char format_str[50];
-        snprintf(format_str, sizeof(format_str), "Partition: %%xd for host: %%.%ds", host_len);
-        Debug("cache_hosting", format_str, res.record, hostname);
+        if (is_debug_tag_set("cache_hosting")) {
+          char format_str[50];
+          snprintf(format_str, sizeof(format_str), "Partition: %%xd for host: %%.%ds", host_len);
+          Debug("cache_hosting", format_str, res.record, hostname);
+        }
         return res.record->parts[host_hash_table[h]];
       }
     }
   }
   if (hash_table) {
-    char format_str[50];
-    snprintf(format_str, sizeof(format_str), "Generic partition: %%xd for host: %%.%ds", host_len);
-    Debug("cache_hosting", format_str, host_rec, hostname);
+    if (is_debug_tag_set("cache_hosting")) {
+      char format_str[50];
+      snprintf(format_str, sizeof(format_str), "Generic partition: %%xd for host: %%.%ds", host_len);
+      Debug("cache_hosting", format_str, host_rec, hostname);
+    }
     return host_rec->parts[hash_table[h]];
   } else
     return host_rec->parts[0];