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

Function cbm_diff_parse

src/mcp/test_impact_diff.c:325–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323}
324
325cbm_diff_t *cbm_diff_parse(const char *text, size_t len) {
326 if (!text && len > 0) {
327 return NULL;
328 }
329 CBMArena arena;
330 cbm_arena_init_sized(&arena, DF_ARENA_BLOCK);
331 cbm_diff_t *d = cbm_arena_calloc(&arena, sizeof(*d));
332 if (!d) {
333 cbm_arena_destroy(&arena);
334 return NULL;
335 }
336 d->arena = arena; /* the diff lives in its own arena */
337 d->complete = true;
338 df_reader_t rd = {.p = text, .end = text ? text + len : text};
339 if (!df_read(d, &rd)) {
340 cbm_diff_free(d);
341 return NULL;
342 }
343 if (d->file_count > 1) {
344 qsort(d->files, (size_t)d->file_count, sizeof(*d->files), df_cmp_file);
345 }
346 return d;
347}
348
349void cbm_diff_free(cbm_diff_t *d) {
350 if (!d) {

Callers 4

cbm_changes_parseFunction · 0.85
ci_legacyFunction · 0.85
diff_ofFunction · 0.85
test_test_impact.cFile · 0.85

Calls 5

cbm_arena_init_sizedFunction · 0.85
cbm_arena_callocFunction · 0.85
df_readFunction · 0.85
cbm_diff_freeFunction · 0.85
cbm_arena_destroyFunction · 0.50

Tested by

no test coverage detected