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

Function env_positive_int

src/foundation/limits.c:33–45  ·  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

31 * Read fresh each call (see cbm_max_file_bytes rationale — cheap, test-friendly,
32 * no stale memoized copy across runs). */
33static int env_positive_int(const char *name, int fallback) {
34 const char *raw = cbm_runtime_getenv(name);
35 if (raw && raw[0]) {
36 errno = 0;
37 char *end = NULL;
38 long v = strtol(raw, &end, 10);
39 if (errno == 0 && end != raw && *end == '\0' && v > 0 && v <= INT_MAX) {
40 return (int)v;
41 }
42 /* Unparseable / non-positive / out-of-range → safe default. */
43 }
44 return fallback;
45}
46
47int cbm_cypher_max_depth(void) {
48 /* 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 1

cbm_runtime_getenvFunction · 0.85

Tested by

no test coverage detected