]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
init commit
authorJennifer Lee <jenlee68@fb.com>
Tue, 10 Mar 2026 00:17:13 +0000 (17:17 -0700)
committerJennifer Lee <jenlee68@fb.com>
Tue, 10 Mar 2026 00:17:13 +0000 (17:17 -0700)
contrib/largeNbDicts/largeNbDicts.c
programs/README.md
programs/fileio.c
programs/zstdcli.c

index 6b6cc34ca1137f676ad67e089e2c66a6780e8e3a..f7496930b796f01df73f067a884f2cee637762ba 100644 (file)
@@ -45,7 +45,9 @@
 #define RUN_TIME_DEFAULT_MS    1000
 #define BENCH_TIME_DEFAULT_MS (BENCH_TIME_DEFAULT_S * RUN_TIME_DEFAULT_MS)
 
-#define DISPLAY_LEVEL_DEFAULT 3
+#ifndef ZSTD_DISPLAY_LEVEL_DEFAULT
+#define ZSTD_DISPLAY_LEVEL_DEFAULT 3
+#endif
 
 #define BENCH_SIZE_MAX (1200 MB)
 
@@ -61,7 +63,7 @@
 
 #define DISPLAY(...)         fprintf(stdout, __VA_ARGS__)
 #define DISPLAYLEVEL(l, ...) { if (g_displayLevel>=l) { DISPLAY(__VA_ARGS__); } }
-static int g_displayLevel = DISPLAY_LEVEL_DEFAULT;   /* 0 : no display,  1: errors,  2 : + result + interaction + warnings,  3 : + progression,  4 : + information */
+static int g_displayLevel = ZSTD_DISPLAY_LEVEL_DEFAULT;   /* 0 : no display,  1: errors,  2 : + result + interaction + warnings,  3 : + progression,  4 : + information */
 
 
 /*---  buffer_t  ---*/
index 2a6978ac4560dd8997c2497212a8a131205f5191..6522b647dd383ffe576b345a3e56a3bcacf20635 100644 (file)
@@ -79,6 +79,13 @@ There are however other Makefile targets that create different variations of CLI
   This can be useful to produce smaller binaries.
   A corresponding `Makefile` target using this ability is `zstd-compress`.
 
+- __ZSTD_DISPLAY_LEVEL_DEFAULT__ : Controls the default verbosity level of `zstd` output.
+  The default value is `2`. Lower values (e.g., `1`) reduce output verbosity,
+  while higher values (e.g., `3`) increase it.
+  This allows setting preferred verbosity at compile time,
+  rather than passing `-q` or `-v` flags at runtime.
+  Example : `CPPFLAGS="-DZSTD_DISPLAY_LEVEL_DEFAULT=1" make`
+
 - __BACKTRACE__ : `zstd` can display a stack backtrace when execution
   generates a runtime exception. By default, this feature may be
   degraded/disabled on some platforms unless additional compiler directives are
index a0dcad817458e140e16589e34ef31f94db6f2571..3b2f9b636332cfa7f43c9a93c7875176852dda46 100644 (file)
@@ -2401,7 +2401,9 @@ int FIO_compressFilename(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs, const
     cRess_t ress = FIO_createCResources(prefs, dictFileName, UTIL_getFileSize(srcFileName), compressionLevel, comprParams);
     int const result = FIO_compressFilename_srcFile(fCtx, prefs, &ress, dstFileName, srcFileName, compressionLevel);
 
-#define DISPLAY_LEVEL_DEFAULT 2
+#ifndef ZSTD_DISPLAY_LEVEL_DEFAULT
+#define ZSTD_DISPLAY_LEVEL_DEFAULT 2
+#endif
 
     FIO_freeCResources(&ress);
     return result;
index 34db7bf51a0058d3378cb23de9eec05492077f56..70e170c47b49d8bfb9c5e23d0c3975c8f11a0c7e 100644 (file)
@@ -77,7 +77,9 @@ static unsigned init_nbWorkers(unsigned defaultNbWorkers);
 #define MB *(1 <<20)
 #define GB *(1U<<30)
 
-#define DISPLAY_LEVEL_DEFAULT 2
+#ifndef ZSTD_DISPLAY_LEVEL_DEFAULT
+#define ZSTD_DISPLAY_LEVEL_DEFAULT 2
+#endif
 
 static const char*    g_defaultDictName = "dictionary";
 static const unsigned g_defaultMaxDictSize = 110 KB;
@@ -104,7 +106,7 @@ typedef enum { cover, fastCover, legacy } dictType;
 **************************************/
 #undef DISPLAYLEVEL
 #define DISPLAYLEVEL(l, ...) { if (g_displayLevel>=l) { DISPLAY(__VA_ARGS__); } }
-static int g_displayLevel = DISPLAY_LEVEL_DEFAULT;   /* 0 : no display,  1: errors,  2 : + result + interaction + warnings,  3 : + progression,  4 : + information */
+static int g_displayLevel = ZSTD_DISPLAY_LEVEL_DEFAULT;   /* 0 : no display,  1: errors,  2 : + result + interaction + warnings,  3 : + progression,  4 : + information */
 
 
 /*-************************************
@@ -660,7 +662,7 @@ static void setMaxCompression(ZSTD_compressionParameters* params)
 
 static void printVersion(void)
 {
-    if (g_displayLevel < DISPLAY_LEVEL_DEFAULT) {
+    if (g_displayLevel < ZSTD_DISPLAY_LEVEL_DEFAULT) {
         DISPLAYOUT("%s\n", ZSTD_VERSION_STRING);
         return;
     }