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

Function dynbuf_ensure

internal/cbm/sqlite_writer.c:301–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299}
300
301static bool dynbuf_ensure(DynBuf *b, int needed) {
302 if (b->len + needed <= b->cap) {
303 return true;
304 }
305 int newcap = b->cap == 0 ? INITIAL_PAGE_CAP : b->cap;
306 while (newcap < b->len + needed) {
307 newcap *= GROWTH_FACTOR;
308 }
309 uint8_t *p = (uint8_t *)realloc(b->data, newcap);
310 if (!p) {
311 (void)fprintf(stderr, "cbm_write_db: dynbuf realloc failed size=%d\n", newcap);
312 return false;
313 }
314 b->data = p;
315 b->cap = newcap;
316 return true;
317}
318
319static bool dynbuf_append(DynBuf *b, const void *data, int len) {
320 if (len <= 0) {

Callers 1

dynbuf_appendFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected