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

Function cbm_error_ranges_str

internal/cbm/cbm.c:1099–1114  ·  view source on GitHub ↗

Serialize collected regions as "start-end,start-end,..." into the arena. */

Source from the content-addressed store, hash-verified

1097
1098/* Serialize collected regions as "start-end,start-end,..." into the arena. */
1099static const char *cbm_error_ranges_str(CBMArena *a, const cbm_error_regions_t *regs) {
1100 if (regs->count <= 0) {
1101 return NULL;
1102 }
1103 enum { RANGE_MAX = 24 }; /* "4294967295-4294967295," */
1104 char *buf = (char *)cbm_arena_alloc(a, (size_t)regs->count * RANGE_MAX);
1105 if (!buf) {
1106 return NULL;
1107 }
1108 size_t off = 0;
1109 for (int i = 0; i < regs->count; i++) {
1110 off += (size_t)snprintf(buf + off, RANGE_MAX, "%s%u-%u", i ? "," : "", regs->starts[i],
1111 regs->ends[i]);
1112 }
1113 return buf;
1114}
1115
1116/* Public entry: run the extraction and journal completion. The DONE mark on
1117 * every ordinary return (including error/timeout results) tells the crash

Callers 1

cbm_extract_file_exFunction · 0.85

Calls 1

cbm_arena_allocFunction · 0.70

Tested by

no test coverage detected