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

Function count_calls_in_func

tests/test_extraction.c:3687–3702  ·  view source on GitHub ↗

#1260: count calls with an exact callee whose enclosing function qn ends * with ". ". has_call() is a substring match, which cannot tell * "Pkg.A.Run" emitted from want_a apart from the same callee in want_b. */

Source from the content-addressed store, hash-verified

3685 * with ".<func>". has_call() is a substring match, which cannot tell
3686 * "Pkg.A.Run" emitted from want_a apart from the same callee in want_b. */
3687static int count_calls_in_func(CBMFileResult *r, const char *callee, const char *func) {
3688 int n = 0;
3689 size_t flen = strlen(func);
3690 for (int i = 0; i < r->calls.count; i++) {
3691 const CBMCall *c = &r->calls.items[i];
3692 if (!c->callee_name || strcmp(c->callee_name, callee) != 0 || !c->enclosing_func_qn) {
3693 continue;
3694 }
3695 size_t qlen = strlen(c->enclosing_func_qn);
3696 if (qlen > flen && c->enclosing_func_qn[qlen - flen - 1] == '.' &&
3697 strcmp(c->enclosing_func_qn + qlen - flen, func) == 0) {
3698 n++;
3699 }
3700 }
3701 return n;
3702}
3703
3704/* #1260: calls in `func` whose callee is "Run" or ends in ".Run", whatever
3705 * the qualifier. One iris.cls("X").Run() site must emit exactly one. */

Callers 1

test_extraction.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected