pick up environment variable */
| 604 | |
| 605 | /* pick up environment variable */ |
| 606 | static 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 |
| 634 | static unsigned init_nbThreads(void) { |
no test coverage detected