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

Function cbm_error_ranges_str

internal/cbm/cbm.c:1135–1150  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1133
1134/* Serialize collected regions as "start-end,start-end,..." into the arena. */
1135static const char *cbm_error_ranges_str(CBMArena *a, const cbm_error_regions_t *regs) {
1136 if (regs->count <= 0) {
1137 return NULL;
1138 }
1139 enum { RANGE_MAX = 24 }; /* "4294967295-4294967295," */
1140 char *buf = (char *)cbm_arena_alloc(a, (size_t)regs->count * RANGE_MAX);
1141 if (!buf) {
1142 return NULL;
1143 }
1144 size_t off = 0;
1145 for (int i = 0; i < regs->count; i++) {
1146 off += (size_t)snprintf(buf + off, RANGE_MAX, "%s%u-%u", i ? "," : "", regs->starts[i],
1147 regs->ends[i]);
1148 }
1149 return buf;
1150}
1151
1152/* Public entry: run the extraction and journal completion. The DONE mark on
1153 * 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