MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / env_positive_int

Function env_positive_int

src/foundation/limits.c:32–44  ·  view source on GitHub ↗

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). */

Source from the content-addressed store, hash-verified

30 * Read fresh each call (see cbm_max_file_bytes rationale — cheap, test-friendly,
31 * no stale memoized copy across runs). */
32static 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
46int cbm_cypher_max_depth(void) {
47 /* 10 — generous for a code call/def graph; an explicit `*1..N` above this is

Callers 2

cbm_cypher_max_depthFunction · 0.85
cbm_mcp_max_depthFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected