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

Function cluster_add_pkg

src/store/store.c:10519–10534  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

10517
10518/* Append `pkg` to a distinct package list (with a per-package count). */
10519static void cluster_add_pkg(const char **pkgs, int *counts, int *count, int cap, const char *pkg) {
10520 if (!pkg || !pkg[0]) {
10521 return;
10522 }
10523 for (int i = 0; i < *count; i++) {
10524 if (strcmp(pkgs[i], pkg) == 0) {
10525 counts[i]++;
10526 return;
10527 }
10528 }
10529 if (*count < cap) {
10530 pkgs[*count] = heap_strdup(pkg);
10531 counts[*count] = 1;
10532 (*count)++;
10533 }
10534}
10535
10536/* Build the cluster_info for one community c into *ci. */
10537static 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