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

Function ap_json_realloc

src/store/architecture_projection.c:53–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53static void *ap_json_realloc(void *context, void *ptr, size_t old_size, size_t size) {
54 ap_json_budget *budget = context;
55 size_t growth = size > old_size ? size - old_size : 0;
56 if (growth > AP_JSON_BUDGET - budget->allocated) {
57 budget->failed = true;
58 return NULL;
59 }
60 void *p = cbm_realloc(CBM_MEM_CLASS_OTHER, ptr, size);
61 if (p)
62 budget->allocated += growth;
63 else
64 budget->failed = true;
65 return p;
66}
67
68static void ap_json_free(void *context, void *ptr) {
69 (void)context;

Callers

nothing calls this directly

Calls 1

cbm_reallocFunction · 0.85

Tested by

no test coverage detected