Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix(watcher): close residual gaps in #207
Martin Vogelc768b6154dde
diff --git a/src/watcher/watcher.c b/src/watcher/watcher.cindex 8d1f85f97..4d0794352 100644--- a/src/watcher/watcher.c+++ b/src/watcher/watcher.c@@ -238,6 +238,10 @@ cbm_watcher_t *cbm_watcher_new(cbm_store_t *store, cbm_index_fn index_fn, void *w->index_fn = index_fn;w->user_data = user_data;w->projects = cbm_ht_create(CBM_SZ_32);+ if (!w->projects) {+ free(w);+ return NULL;+ }cbm_mutex_init(&w->projects_lock);atomic_init(&w->stopped, 0);return w;@@ -319,13 +323,13 @@ void cbm_watcher_touch(cbm_watcher_t *w, const char *project_name) {cbm_mutex_unlock(&w->projects_lock);}-int cbm_watcher_watch_count(const cbm_watcher_t *w) {+int cbm_watcher_watch_count(cbm_watcher_t *w) {if (!w) {return 0;}- cbm_mutex_lock(&((cbm_watcher_t *)w)->projects_lock);+ cbm_mutex_lock(&w->projects_lock);int count = (int)cbm_ht_count(w->projects);- cbm_mutex_unlock(&((cbm_watcher_t *)w)->projects_lock);+ cbm_mutex_unlock(&w->projects_lock);return count;}diff --git a/src/watcher/watcher.h b/src/watcher/watcher.hindex 259210977..80ef826d0 100644--- a/src/watcher/watcher.h+++ b/src/watcher/watcher.h@@ -64,7 +64,7 @@ void cbm_watcher_stop(cbm_watcher_t *w);/* ── Introspection (for testing) ────────────────────────────────── *//* Return the number of projects in the watch list. */-int cbm_watcher_watch_count(const cbm_watcher_t *w);+int cbm_watcher_watch_count(cbm_watcher_t *w);/* Return the adaptive poll interval (ms) for a given file count. */int cbm_watcher_poll_interval_ms(int file_count);