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

Function pc_env_begin

tests/test_pipeline_conventions.c:122–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120 return ok;
121}
122static bool pc_env_begin(pc_env_t *env, bool parallel) {
123 memset(env, 0, sizeof(*env));
124 const char *names[] = {"CBM_WORKERS", "CBM_INDEX_SINGLE_THREAD", "CBM_DISABLE_LSP_CROSS", "CBM_MEM_SPILL"};
125 for (size_t i = 0; i < 4; i++) {
126 env->values[i].name = names[i];
127 const char *value = getenv(names[i]);
128 env->values[i].present = value != NULL;
129 if (value) {
130 if (strlen(value) >= sizeof(env->values[i].value)) return false;
131 memcpy(env->values[i].value, value, strlen(value) + 1);
132 }
133 }
134 env->saved = true;
135 bool ok = cbm_setenv("CBM_WORKERS", "2", 1) == 0;
136 if (parallel) (void)cbm_unsetenv("CBM_INDEX_SINGLE_THREAD");
137 else ok = cbm_setenv("CBM_INDEX_SINGLE_THREAD", "1", 1) == 0 && ok;
138 (void)cbm_unsetenv("CBM_DISABLE_LSP_CROSS");
139 (void)cbm_unsetenv("CBM_MEM_SPILL");
140 const char *single = getenv("CBM_INDEX_SINGLE_THREAD");
141 ok = ok && cbm_default_worker_count(true) == 2 &&
142 (parallel ? single == NULL : single && strcmp(single, "1") == 0) &&
143 getenv("CBM_DISABLE_LSP_CROSS") == NULL && getenv("CBM_MEM_SPILL") == NULL;
144 if (!ok) (void)pc_env_restore(env);
145 return ok;
146}
147static bool pc_text(const char *a, const char *b) { return a && b && strcmp(a, b) == 0; }
148static bool pc_role(const cbm_node_t *n, const char *role) {
149 if (!n || !n->properties_json) return false;

Callers 3

pc_configured_caseFunction · 0.85
pc_typed_degradeFunction · 0.85

Calls 4

cbm_setenvFunction · 0.85
cbm_unsetenvFunction · 0.85
cbm_default_worker_countFunction · 0.85
pc_env_restoreFunction · 0.85

Tested by

no test coverage detected