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

Function gm_hops_push

src/store/graph_mem.c:678–693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

676} gm_hops_t;
677
678static bool gm_hops_push(gm_hops_t *h, uint32_t id, int hop) {
679 if (h->count == h->cap) {
680 size_t next = h->cap ? h->cap * GM_GROWTH : GM_SET_MIN_CAP;
681 cbm_graph_mem_hop_t *rows =
682 cbm_realloc(CBM_MEM_CLASS_GRAPH_CACHE, h->rows, next * sizeof(cbm_graph_mem_hop_t));
683 if (!rows) {
684 return false;
685 }
686 h->rows = rows;
687 h->cap = next;
688 }
689 h->rows[h->count].id = id;
690 h->rows[h->count].hop = hop;
691 h->count++;
692 return true;
693}
694
695static int gm_hop_id_cmp(const void *pa, const void *pb) {
696 const cbm_graph_mem_hop_t *a = pa;

Callers 1

gm_expand_levelFunction · 0.85

Calls 1

cbm_reallocFunction · 0.85

Tested by

no test coverage detected