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

Function init_nbThreads

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

Source from the content-addressed store, hash-verified

632
633#ifdef ZSTD_MULTITHREAD
634static unsigned init_nbThreads(void) {
635 const char* const env = getenv(ENV_NBTHREADS);
636 if (env != NULL) {
637 const char* ptr = env;
638 if ((*ptr>='0') && (*ptr<='9')) {
639 unsigned nbThreads;
640 if (readU32FromCharChecked(&ptr, &nbThreads)) {
641 DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: numeric value too large \n", ENV_NBTHREADS, env);
642 return ZSTDCLI_NBTHREADS_DEFAULT;
643 } else if (*ptr == 0) {
644 return nbThreads;
645 }
646 }
647 DISPLAYLEVEL(2, "Ignore environment variable setting %s=%s: not a valid unsigned value \n", ENV_NBTHREADS, env);
648 }
649
650 return ZSTDCLI_NBTHREADS_DEFAULT;
651}
652#endif
653
654#define NEXT_FIELD(ptr) { \

Callers 1

mainFunction · 0.85

Calls 1

readU32FromCharCheckedFunction · 0.85

Tested by

no test coverage detected