Change name to ZSTD_NUMTHREADS

This commit is contained in:
senhuang42 2020-09-01 09:02:23 -04:00
parent 70fa7b37ca
commit 565f116a56

View File

@ -16,8 +16,8 @@
# define ZSTDCLI_CLEVEL_DEFAULT 3 # define ZSTDCLI_CLEVEL_DEFAULT 3
#endif #endif
#ifndef ZSTD_THREADS_DEFAULT #ifndef ZSTD_NUMTHREADS_DEFAULT
# define ZSTD_THREADS_DEFAULT 3 # define ZSTD_NUMTHREADS_DEFAULT 3
#endif #endif
#ifndef ZSTDCLI_CLEVEL_MAX #ifndef ZSTDCLI_CLEVEL_MAX
@ -590,7 +590,7 @@ static void printVersion(void)
/* Environment variables for parameter setting */ /* Environment variables for parameter setting */
#define ENV_CLEVEL "ZSTD_CLEVEL" #define ENV_CLEVEL "ZSTD_CLEVEL"
#define ENV_THREADS "ZSTD_THREADS" #define ENV_NUMTHREADS "ZSTD_NUMTHREADS"
/* pick up environment variable */ /* pick up environment variable */
static int init_cLevel(void) { static int init_cLevel(void) {
@ -622,22 +622,22 @@ static int init_cLevel(void) {
/* pick up environment variable */ /* pick up environment variable */
static unsigned init_numThreads(void) { static unsigned init_numThreads(void) {
const char* const env = getenv(ENV_THREADS); const char* const env = getenv(ENV_NUMTHREADS);
if (env != NULL) { if (env != NULL) {
const char* ptr = env; const char* ptr = env;
if ((*ptr>='0') && (*ptr<='9')) { if ((*ptr>='0') && (*ptr<='9')) {
unsigned numThreads; unsigned numThreads;
if (readU32FromCharChecked(&ptr, &numThreads)) { if (readU32FromCharChecked(&ptr, &numThreads)) {
DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: numeric value too large \n", ENV_THREADS, env); DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: numeric value too large \n", ENV_NUMTHREADS, env);
return ZSTD_THREADS_DEFAULT; return ZSTD_NUMTHREADS_DEFAULT;
} else if (*ptr == 0) { } else if (*ptr == 0) {
return numThreads; return numThreads;
} }
} }
DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: not a valid integer value \n", ENV_THREADS, env); DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: not a valid unsigned value \n", ENV_NUMTHREADS, env);
} }
return ZSTD_THREADS_DEFAULT; return ZSTD_NUMTHREADS_DEFAULT;
} }
#define NEXT_FIELD(ptr) { \ #define NEXT_FIELD(ptr) { \