| 917 | static void state_free(project_state_t *s); |
| 918 | |
| 919 | static 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 | |
| 938 | static void state_free(project_state_t *s) { |
| 939 | if (!s) { |
no test coverage detected