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

Function lookup_pkg

src/store/store.c:3915–3930  ·  view source on GitHub ↗

Look up package name for a node ID in the parallel arrays. nids must be * sorted ascending (the node query orders by id) — a linear scan here is * O(E×N) across the edge loop and spun for >10 minutes on Linux-kernel-sized * graphs (~1.4M defs × ~1.4M CALLS edges). */

Source from the content-addressed store, hash-verified

3913 * O(E×N) across the edge loop and spun for >10 minutes on Linux-kernel-sized
3914 * graphs (~1.4M defs × ~1.4M CALLS edges). */
3915static const char *lookup_pkg(const int64_t *nids, char **npkgs, int nn, int64_t id) {
3916 int lo = 0;
3917 int hi = nn - SKIP_ONE;
3918 while (lo <= hi) {
3919 int mid = lo + (hi - lo) / PAIR_LEN;
3920 if (nids[mid] == id) {
3921 return npkgs[mid];
3922 }
3923 if (nids[mid] < id) {
3924 lo = mid + SKIP_ONE;
3925 } else {
3926 hi = mid - SKIP_ONE;
3927 }
3928 }
3929 return NULL;
3930}
3931
3932/* Accumulate a cross-package boundary into parallel arrays. */
3933static void accum_boundary(const char *src_pkg, const char *tgt_pkg, char **bfroms, char **btos,

Callers 1

arch_boundariesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected