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

Function pr_grow

src/pipeline/doc_links_php.c:172–188  ·  view source on GitHub ↗

Room for one more item in a growing arena array. */

Source from the content-addressed store, hash-verified

170
171/* Room for one more item in a growing arena array. */
172static bool pr_grow(pr_index_t *ix, void **items, int count, int *cap, size_t size) {
173 if (count < *cap) {
174 return true;
175 }
176 int ncap = *cap ? *cap * PAIR_LEN : CBM_SZ_8;
177 void *g = cbm_arena_alloc(&ix->arena, (size_t)ncap * size);
178 if (!g) {
179 ix->oom = true;
180 return false;
181 }
182 if (count) {
183 memcpy(g, *items, (size_t)count * size);
184 }
185 *items = g;
186 *cap = ncap;
187 return true;
188}
189
190static bool pr_dash(const char *s, size_t n) {
191 return n == SKIP_ONE && s[0] == '-';

Callers 2

pr_read_typeFunction · 0.85
pr_read_recordFunction · 0.85

Calls 1

cbm_arena_allocFunction · 0.50

Tested by

no test coverage detected