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

Function cluster_add_pkg

src/store/store.c:5212–5227  ·  view source on GitHub ↗

Append `pkg` to a distinct package list (with a per-package count). */

Source from the content-addressed store, hash-verified

5210
5211/* Append `pkg` to a distinct package list (with a per-package count). */
5212static void cluster_add_pkg(const char **pkgs, int *counts, int *count, int cap, const char *pkg) {
5213 if (!pkg || !pkg[0]) {
5214 return;
5215 }
5216 for (int i = 0; i < *count; i++) {
5217 if (strcmp(pkgs[i], pkg) == 0) {
5218 counts[i]++;
5219 return;
5220 }
5221 }
5222 if (*count < cap) {
5223 pkgs[*count] = heap_strdup(pkg);
5224 counts[*count] = 1;
5225 (*count)++;
5226 }
5227}
5228
5229/* Build the cluster_info for one community c into *ci. */
5230static void cluster_build_one(cbm_cluster_info_t *ci, int c, int n, const int *comm,

Callers 1

cluster_build_oneFunction · 0.85

Calls 1

heap_strdupFunction · 0.70

Tested by

no test coverage detected