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

Function cr_list

internal/cbm/result_compact.c:211–238  ·  view source on GitHub ↗

A NULL-terminated list of strings: the pointer array plus each string. */

Source from the content-addressed store, hash-verified

209
210/* A NULL-terminated list of strings: the pointer array plus each string. */
211static void cr_list(cr_ctx_t *c, const char ***field) {
212 const char **list = *field;
213 if (!list) {
214 return;
215 }
216 int n = 0;
217 if (c->phase == CR_RELOCATE) {
218 /* The array may live in a block we can no longer read at its old
219 * address: relocate the pointer first, then count and walk it. */
220 cr_blob(c, (const void **)field, sizeof(char *));
221 list = *field;
222 while (list[n]) {
223 n++;
224 }
225 for (int i = 0; i < n; i++) {
226 cr_str(c, &list[i]);
227 }
228 return;
229 }
230 while (list[n]) {
231 n++;
232 }
233 cr_blob(c, (const void **)field, (size_t)(n + SKIP_ONE) * sizeof(char *));
234 const char **walk = *field; /* the copy in COPY, the original otherwise */
235 for (int i = 0; i < n && walk; i++) {
236 cr_str(c, &walk[i]);
237 }
238}
239
240/* A counted list of strings (signature_param_types). */
241static void cr_counted_list(cr_ctx_t *c, const char ***field, int count) {

Callers 2

cr_walk_defFunction · 0.85
cr_walkFunction · 0.85

Calls 2

cr_blobFunction · 0.85
cr_strFunction · 0.85

Tested by

no test coverage detected