]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
log: Move SEVERITY_MASK_IDX() to log.h
authorteor <teor@torproject.org>
Mon, 5 Aug 2019 10:04:08 +0000 (20:04 +1000)
committerteor <teor@torproject.org>
Wed, 25 Sep 2019 06:37:07 +0000 (16:37 +1000)
Move SEVERITY_MASK_IDX() to log.h private/unit tests section, so that
we can use it in log.c, the unit tests, and the fuzzers.

(The test and fuzzer code changes are in a subsequent commit.)

Preparation for bug 31334.

src/lib/log/log.c
src/lib/log/log.h

index be6f459554b635ff596ccb7df24612ae937134be..9373fd4042b792a3b386f7b64834f67c1568a01b 100644 (file)
 #include <android/log.h>
 #endif // HAVE_ANDROID_LOG_H.
 
-/** Given a severity, yields an index into log_severity_list_t.masks to use
- * for that severity. */
-#define SEVERITY_MASK_IDX(sev) ((sev) - LOG_ERR)
-
 /** @{ */
 /** The string we stick at the end of a log message when it is too long,
  * and its length. */
index 4291418eb6ff8c48138736781e7ded250e968dbd..da4bcbe60818aa410de99b20ebf02f4467b3d8b9 100644 (file)
@@ -297,4 +297,10 @@ MOCK_DECL(STATIC void, logv, (int severity, log_domain_mask_t domain,
     va_list ap) CHECK_PRINTF(5,0));
 #endif
 
+#if defined(LOG_PRIVATE) || defined(TOR_UNIT_TESTS)
+/** Given a severity, yields an index into log_severity_list_t.masks to use
+ * for that severity. */
+#define SEVERITY_MASK_IDX(sev) ((sev) - LOG_ERR)
+#endif
+
 #endif /* !defined(TOR_TORLOG_H) */