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

Function cbm_test_declarations_parse

src/discover/test_conventions.c:240–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238}
239
240cbm_test_declarations_t *cbm_test_declarations_parse(const char *bytes, size_t len, bool absent) {
241 if (len > TD_MAX_BYTES || (absent && len) || (!absent && (!bytes || !len)) ||
242 (len && memchr(bytes, '\0', len)))
243 return NULL;
244 CBMArena arena;
245 cbm_arena_init_lazy(&arena, 4096);
246 cbm_test_declarations_t *declarations = cbm_arena_calloc(&arena, sizeof(*declarations));
247 if (!declarations) {
248 cbm_arena_destroy(&arena);
249 return NULL;
250 }
251 declarations->arena = arena;
252 for (int preset = 0; preset < CBM_TEST_PRESET_COUNT; preset++)
253 declarations->presets[preset] = preset != CBM_TEST_PRESET_C_CBM;
254 bool valid = true;
255 if (!absent) {
256 yyjson_doc *doc = yyjson_read(bytes, len, 0);
257 if (!doc) {
258 valid = false;
259 } else {
260 valid = td_project(declarations, yyjson_doc_get_root(doc));
261 yyjson_doc_free(doc);
262 }
263 }
264 if (!valid) {
265 cbm_test_declarations_free(declarations);
266 return NULL;
267 }
268 td_digest(declarations, bytes, len, absent);
269 return declarations;
270}
271
272void cbm_test_declarations_free(cbm_test_declarations_t *declarations) {
273 if (!declarations)

Callers 10

te_ledger_and_registryFunction · 0.85
frozen_configFunction · 0.85
tc_configFunction · 0.85
pc_collect_spill_witnessFunction · 0.85
declarations_ofFunction · 0.85
test_test_impact.cFile · 0.85

Calls 6

cbm_arena_init_lazyFunction · 0.85
cbm_arena_callocFunction · 0.85
td_projectFunction · 0.85
td_digestFunction · 0.85
cbm_arena_destroyFunction · 0.50

Tested by

no test coverage detected