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

Function string_list_reserve

src/cypher/cypher.c:4350–4355  ·  view source on GitHub ↗

Grow a string list for one more entry at `idx`: the capacity doubles at * every power of two, so n appends cost O(n) copying, not O(n^2). */

Source from the content-addressed store, hash-verified

4348/* Grow a string list for one more entry at `idx`: the capacity doubles at
4349 * every power of two, so n appends cost O(n) copying, not O(n^2). */
4350static char **string_list_reserve(char **list, int idx) {
4351 if (idx > 0 && (idx & (idx - SKIP_ONE)) != 0) {
4352 return list; /* capacity is the next power of two above idx */
4353 }
4354 return safe_realloc(list, (size_t)(idx ? idx * PAIR_LEN : SKIP_ONE) * sizeof(char *));
4355}
4356
4357enum { DISTINCT_SET_MIN = 16 }; /* below this a set is scanned, not hashed */
4358

Callers 2

distinct_list_addFunction · 0.85
ret_agg_accumulateFunction · 0.85

Calls 1

safe_reallocFunction · 0.85

Tested by

no test coverage detected