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

Function state_new

src/watcher/watcher.c:919–936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

917static void state_free(project_state_t *s);
918
919static project_state_t *state_new(const char *name, const char *root_path) {
920 project_state_t *s = calloc(CBM_ALLOC_ONE, sizeof(*s));
921 if (!s) {
922 return NULL;
923 }
924 s->project_name = strdup(name);
925 s->root_path = strdup(root_path);
926 if (!s->project_name || !s->root_path) {
927 state_free(s);
928 return NULL;
929 }
930 atomic_init(&s->registered, true);
931 s->interval_ms = POLL_BASE_MS;
932 atomic_init(&s->status_strategy, CBM_WATCHER_STRATEGY_PENDING);
933 atomic_init(&s->status_interval_ms, POLL_BASE_MS);
934 atomic_init(&s->status_last_scan_s, 0);
935 return s;
936}
937
938static void state_free(project_state_t *s) {
939 if (!s) {

Callers 1

cbm_watcher_watchFunction · 0.85

Calls 1

state_freeFunction · 0.85

Tested by

no test coverage detected