Shared env-int parser: a positive integer in [1, INT_MAX], else the fallback. * Read fresh each call (see cbm_max_file_bytes rationale — cheap, test-friendly, * no stale memoized copy across runs). */
| 30 | * Read fresh each call (see cbm_max_file_bytes rationale — cheap, test-friendly, |
| 31 | * no stale memoized copy across runs). */ |
| 32 | static int env_positive_int(const char *name, int fallback) { |
| 33 | const char *raw = getenv(name); |
| 34 | if (raw && raw[0]) { |
| 35 | errno = 0; |
| 36 | char *end = NULL; |
| 37 | long v = strtol(raw, &end, 10); |
| 38 | if (errno == 0 && end != raw && *end == '\0' && v > 0 && v <= INT_MAX) { |
| 39 | return (int)v; |
| 40 | } |
| 41 | /* Unparseable / non-positive / out-of-range → safe default. */ |
| 42 | } |
| 43 | return fallback; |
| 44 | } |
| 45 | |
| 46 | int cbm_cypher_max_depth(void) { |
| 47 | /* 10 — generous for a code call/def graph; an explicit `*1..N` above this is |
no outgoing calls
no test coverage detected