Commit fc760c50 authored by George Kadianakis's avatar George Kadianakis
Browse files

Merge branch 'tor-github/pr/1356'

parents 4673cb81 d30a042f
Loading
Loading
Loading
Loading

changes/bug31334

0 → 100644
+4 −0
Original line number Diff line number Diff line
  o Code simplification and refactoring:
    - Use SEVERITY_MASK_IDX() to find the LOG_* mask indexes in the unit
      tests and fuzzers, rather than using hard-coded values.
      Closes ticket 31334.
+0 −4
Original line number Diff line number Diff line
@@ -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. */
+6 −0
Original line number Diff line number Diff line
@@ -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) */
+1 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ main(int argc, char **argv)
    memset(&s, 0, sizeof(s));
    set_log_severity_config(loglevel, LOG_ERR, &s);
    /* ALWAYS log bug warnings. */
    s.masks[LOG_WARN-LOG_ERR] |= LD_BUG;
    s.masks[SEVERITY_MASK_IDX(LOG_WARN)] |= LD_BUG;
    add_stream_log(&s, "", fileno(stdout));
  }

+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ test_get_sigsafe_err_fds(void *arg)

  set_log_severity_config(LOG_WARN, LOG_ERR, &include_bug);
  set_log_severity_config(LOG_WARN, LOG_ERR, &no_bug);
  no_bug.masks[0] &= ~(LD_BUG|LD_GENERAL);
  no_bug.masks[SEVERITY_MASK_IDX(LOG_ERR)] &= ~(LD_BUG|LD_GENERAL);
  set_log_severity_config(LOG_INFO, LOG_NOTICE, &no_bug2);

  /* Add some logs; make sure the output is as expected. */
Loading