MCPcopy Create free account
hub / github.com/F-Stack/f-stack / init_cLevel

Function init_cLevel

freebsd/contrib/zstd/programs/zstdcli.c:606–631  ·  view source on GitHub ↗

pick up environment variable */

Source from the content-addressed store, hash-verified

604
605/* pick up environment variable */
606static int init_cLevel(void) {
607 const char* const env = getenv(ENV_CLEVEL);
608 if (env != NULL) {
609 const char* ptr = env;
610 int sign = 1;
611 if (*ptr == '-') {
612 sign = -1;
613 ptr++;
614 } else if (*ptr == '+') {
615 ptr++;
616 }
617
618 if ((*ptr>='0') && (*ptr<='9')) {
619 unsigned absLevel;
620 if (readU32FromCharChecked(&ptr, &absLevel)) {
621 DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: numeric value too large \n", ENV_CLEVEL, env);
622 return ZSTDCLI_CLEVEL_DEFAULT;
623 } else if (*ptr == 0) {
624 return sign * (int)absLevel;
625 } }
626
627 DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: not a valid integer value \n", ENV_CLEVEL, env);
628 }
629
630 return ZSTDCLI_CLEVEL_DEFAULT;
631}
632
633#ifdef ZSTD_MULTITHREAD
634static unsigned init_nbThreads(void) {

Callers 1

mainFunction · 0.85

Calls 1

readU32FromCharCheckedFunction · 0.85

Tested by

no test coverage detected