Skip to content

Commit 2293e96

Browse files
author
Jennifer Lee
committed
init commit
1 parent 6e1e545 commit 2293e96

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

contrib/largeNbDicts/largeNbDicts.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@
4545
#define RUN_TIME_DEFAULT_MS 1000
4646
#define BENCH_TIME_DEFAULT_MS (BENCH_TIME_DEFAULT_S * RUN_TIME_DEFAULT_MS)
4747

48-
#define DISPLAY_LEVEL_DEFAULT 3
48+
#ifndef ZSTD_DISPLAY_LEVEL_DEFAULT
49+
#define ZSTD_DISPLAY_LEVEL_DEFAULT 3
50+
#endif
4951

5052
#define BENCH_SIZE_MAX (1200 MB)
5153

@@ -61,7 +63,7 @@
6163

6264
#define DISPLAY(...) fprintf(stdout, __VA_ARGS__)
6365
#define DISPLAYLEVEL(l, ...) { if (g_displayLevel>=l) { DISPLAY(__VA_ARGS__); } }
64-
static int g_displayLevel = DISPLAY_LEVEL_DEFAULT; /* 0 : no display, 1: errors, 2 : + result + interaction + warnings, 3 : + progression, 4 : + information */
66+
static int g_displayLevel = ZSTD_DISPLAY_LEVEL_DEFAULT; /* 0 : no display, 1: errors, 2 : + result + interaction + warnings, 3 : + progression, 4 : + information */
6567

6668

6769
/*--- buffer_t ---*/

programs/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ There are however other Makefile targets that create different variations of CLI
7979
This can be useful to produce smaller binaries.
8080
A corresponding `Makefile` target using this ability is `zstd-compress`.
8181

82+
- __ZSTD_DISPLAY_LEVEL_DEFAULT__ : Controls the default verbosity level of `zstd` output.
83+
The default value is `2`. Lower values (e.g., `1`) reduce output verbosity,
84+
while higher values (e.g., `3`) increase it.
85+
This allows setting preferred verbosity at compile time,
86+
rather than passing `-q` or `-v` flags at runtime.
87+
Example : `CPPFLAGS="-DZSTD_DISPLAY_LEVEL_DEFAULT=1" make`
88+
8289
- __BACKTRACE__ : `zstd` can display a stack backtrace when execution
8390
generates a runtime exception. By default, this feature may be
8491
degraded/disabled on some platforms unless additional compiler directives are

programs/fileio.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2401,7 +2401,9 @@ int FIO_compressFilename(FIO_ctx_t* const fCtx, FIO_prefs_t* const prefs, const
24012401
cRess_t ress = FIO_createCResources(prefs, dictFileName, UTIL_getFileSize(srcFileName), compressionLevel, comprParams);
24022402
int const result = FIO_compressFilename_srcFile(fCtx, prefs, &ress, dstFileName, srcFileName, compressionLevel);
24032403

2404-
#define DISPLAY_LEVEL_DEFAULT 2
2404+
#ifndef ZSTD_DISPLAY_LEVEL_DEFAULT
2405+
#define ZSTD_DISPLAY_LEVEL_DEFAULT 2
2406+
#endif
24052407

24062408
FIO_freeCResources(&ress);
24072409
return result;

programs/zstdcli.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ static unsigned init_nbWorkers(unsigned defaultNbWorkers);
7777
#define MB *(1 <<20)
7878
#define GB *(1U<<30)
7979

80-
#define DISPLAY_LEVEL_DEFAULT 2
80+
#ifndef ZSTD_DISPLAY_LEVEL_DEFAULT
81+
#define ZSTD_DISPLAY_LEVEL_DEFAULT 2
82+
#endif
8183

8284
static const char* g_defaultDictName = "dictionary";
8385
static const unsigned g_defaultMaxDictSize = 110 KB;
@@ -104,7 +106,7 @@ typedef enum { cover, fastCover, legacy } dictType;
104106
**************************************/
105107
#undef DISPLAYLEVEL
106108
#define DISPLAYLEVEL(l, ...) { if (g_displayLevel>=l) { DISPLAY(__VA_ARGS__); } }
107-
static int g_displayLevel = DISPLAY_LEVEL_DEFAULT; /* 0 : no display, 1: errors, 2 : + result + interaction + warnings, 3 : + progression, 4 : + information */
109+
static int g_displayLevel = ZSTD_DISPLAY_LEVEL_DEFAULT; /* 0 : no display, 1: errors, 2 : + result + interaction + warnings, 3 : + progression, 4 : + information */
108110

109111

110112
/*-************************************
@@ -660,7 +662,7 @@ static void setMaxCompression(ZSTD_compressionParameters* params)
660662

661663
static void printVersion(void)
662664
{
663-
if (g_displayLevel < DISPLAY_LEVEL_DEFAULT) {
665+
if (g_displayLevel < ZSTD_DISPLAY_LEVEL_DEFAULT) {
664666
DISPLAYOUT("%s\n", ZSTD_VERSION_STRING);
665667
return;
666668
}

0 commit comments

Comments
 (0)