diff options
Diffstat (limited to 'src/common/util.h')
-rw-r--r-- | src/common/util.h | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/common/util.h b/src/common/util.h index 858162a074..1019b5807d 100644 --- a/src/common/util.h +++ b/src/common/util.h @@ -38,14 +38,25 @@ */ #error "Sorry; we don't support building with NDEBUG." #else -#define tor_assert(expr) do { \ - if (!(expr)) { \ - log(LOG_ERR, "%s:%d: %s: Assertion %s failed; aborting.", \ - _SHORT_FILE_, __LINE__, __FUNCTION__, #expr); \ - fprintf(stderr,"%s:%d %s: Assertion %s failed; aborting.\n", \ - _SHORT_FILE_, __LINE__, __FUNCTION__, #expr); \ - abort(); /* unreached */ \ +#ifdef OLD_LOG_INTERFACE +#define tor_assert(expr) do { \ + if (!(expr)) { \ + log(LOG_ERR, "%s:%d: %s: Assertion %s failed; aborting.", \ + _SHORT_FILE_, __LINE__, __FUNCTION__, #expr); \ + fprintf(stderr,"%s:%d %s: Assertion %s failed; aborting.\n", \ + _SHORT_FILE_, __LINE__, __FUNCTION__, #expr); \ + abort(); /* unreached */ \ } } while (0) +#else +#define tor_assert(expr) do { \ + if (!(expr)) { \ + log(LOG_ERR, LD_GENERAL, "%s:%d: %s: Assertion %s failed; aborting.", \ + _SHORT_FILE_, __LINE__, __FUNCTION__, #expr); \ + fprintf(stderr,"%s:%d %s: Assertion %s failed; aborting.\n", \ + _SHORT_FILE_, __LINE__, __FUNCTION__, #expr); \ + abort(); /* unreached */ \ + } } while (0) +#endif #endif #ifdef USE_DMALLOC |