]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
moved UTIL_DISPLAY() inside util.c
authorYann Collet <cyan@fb.com>
Tue, 26 Nov 2019 23:21:58 +0000 (15:21 -0800)
committerYann Collet <cyan@fb.com>
Tue, 26 Nov 2019 23:21:58 +0000 (15:21 -0800)
programs/util.c
programs/util.h

index 5354e864d7bb7fea03df3b816346d05fbec53d4c..703c06552bd0f206738835b2fa8bbda1d73c86a8 100644 (file)
@@ -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)
index 53431657d1ea0dcbac84713def1e1902e4ef5d68..7beaec64e815f1aec6a32ac22060d3b91db32bf6 100644 (file)
@@ -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__); } }
 
 
 /*-****************************************