[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] log: Move SEVERITY_MASK_IDX() to log.h



commit 1ad1e84b17267f04960b322effaf57ea8a9690c0
Author: teor <teor@xxxxxxxxxxxxxx>
Date:   Mon Aug 5 20:04:08 2019 +1000

    log: Move SEVERITY_MASK_IDX() to log.h
    
    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 | 4 ----
 src/lib/log/log.h | 6 ++++++
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/lib/log/log.c b/src/lib/log/log.c
index be6f45955..9373fd404 100644
--- a/src/lib/log/log.c
+++ b/src/lib/log/log.c
@@ -55,10 +55,6 @@
 #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. */
diff --git a/src/lib/log/log.h b/src/lib/log/log.h
index 4291418eb..da4bcbe60 100644
--- a/src/lib/log/log.h
+++ b/src/lib/log/log.h
@@ -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) */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits