From 7543cd055cb94a26f03aff44e334b3c4cba009fe Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 26 Nov 2019 15:21:58 -0800 Subject: [PATCH] moved UTIL_DISPLAY() inside util.c --- programs/util.c | 14 ++++++++++---- programs/util.h | 2 -- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/programs/util.c b/programs/util.c index 5354e864d..703c06552 100644 --- a/programs/util.c +++ b/programs/util.c @@ -49,8 +49,11 @@ extern "C" { * Internal Macros ******************************************/ -/* CONTROL is like an assert(), but is never disabled. - * Since it's always active, it can trigger side effects. +/* CONTROL is almost like an assert(), but is never disabled. + * It's designed for failures that may happen rarely, + * but we don't want to maintain a specific error code path for them, + * such as a malloc() returning NULL for example. + * Since it's always active, this macro can trigger side effects. */ #define CONTROL(c) { \ if (!(c)) { \ @@ -59,8 +62,11 @@ extern "C" { exit(1); \ } } -/* - * A modified version of realloc(). +/* console log */ +#define UTIL_DISPLAY(...) fprintf(stderr, __VA_ARGS__) +#define UTIL_DISPLAYLEVEL(l, ...) { if (g_utilDisplayLevel>=l) { UTIL_DISPLAY(__VA_ARGS__); } } + +/* A modified version of realloc(). * If UTIL_realloc() fails the original block is freed. */ UTIL_STATIC void* UTIL_realloc(void *ptr, size_t size) diff --git a/programs/util.h b/programs/util.h index 53431657d..7beaec64e 100644 --- a/programs/util.h +++ b/programs/util.h @@ -92,8 +92,6 @@ extern "C" { * Console log ******************************************/ extern int g_utilDisplayLevel; -#define UTIL_DISPLAY(...) fprintf(stderr, __VA_ARGS__) -#define UTIL_DISPLAYLEVEL(l, ...) { if (g_utilDisplayLevel>=l) { UTIL_DISPLAY(__VA_ARGS__); } } /*-****************************************