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

Function nth_def_named

tests/repro/repro_issue495.c:73–86  ·  view source on GitHub ↗

Return the Nth (0-based) def matching label + name, or NULL. */

Source from the content-addressed store, hash-verified

71
72/* Return the Nth (0-based) def matching label + name, or NULL. */
73static CBMDefinition *nth_def_named(CBMFileResult *r, const char *label, const char *name, int nth) {
74 int seen = 0;
75 for (int i = 0; i < r->defs.count; i++) {
76 CBMDefinition *d = &r->defs.items[i];
77 if (label && (!d->label || strcmp(d->label, label) != 0))
78 continue;
79 if (name && (!d->name || strcmp(d->name, name) != 0))
80 continue;
81 if (seen == nth)
82 return d;
83 seen++;
84 }
85 return NULL;
86}
87
88/* ── Test ─────────────────────────────────────────────────────────── */
89

Callers 1

repro_issue495.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected