瀏覽代碼

use ARRAY_LENGTH macro in domain_to_string

Nick Mathewson 9 年之前
父節點
當前提交
3f993dacc1
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/common/log.c

+ 1 - 1
src/common/log.c

@@ -1246,7 +1246,7 @@ domain_to_string(log_domain_mask_t domain, char *buf, size_t buflen)
     const char *d;
     int bit = tor_log2(domain);
     size_t n;
-    if ((unsigned)bit >= sizeof(domain_list)/sizeof(*domain_list) - 1 ||
+    if ((unsigned)bit >= ARRAY_LENGTH(domain_list)-1 ||
         bit >= N_LOGGING_DOMAINS) {
       tor_snprintf(buf, buflen, "<BUG:Unknown domain %lx>", (long)domain);
       return buf+strlen(buf);