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

Function agent_splice

src/cli/agent_clients.c:1284–1300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1282}
1283
1284static char *agent_splice(const char *document, size_t length, size_t start, size_t end,
1285 const char *replacement) {
1286 size_t replacement_len = strlen(replacement);
1287 if (start > end || end > length || replacement_len > SIZE_MAX - (length - (end - start)) - 1U) {
1288 return NULL;
1289 }
1290 size_t new_length = length - (end - start) + replacement_len;
1291 char *updated = (char *)malloc(new_length + 1U);
1292 if (!updated) {
1293 return NULL;
1294 }
1295 memcpy(updated, document, start);
1296 memcpy(updated + start, replacement, replacement_len);
1297 memcpy(updated + start + replacement_len, document + end, length - end);
1298 updated[new_length] = '\0';
1299 return updated;
1300}
1301
1302static int agent_continue_edit(const char *config_path, const char *binary_path, bool remove) {
1303 char *document = NULL;

Callers 1

agent_continue_editFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected