| 699 | static void state_free(project_state_t *s); |
| 700 | |
| 701 | static project_state_t *state_new(const char *name, const char *root_path) { |
| 702 | project_state_t *s = calloc(CBM_ALLOC_ONE, sizeof(*s)); |
| 703 | if (!s) { |
| 704 | return NULL; |
| 705 | } |
| 706 | s->project_name = strdup(name); |
| 707 | s->root_path = strdup(root_path); |
| 708 | if (!s->project_name || !s->root_path) { |
| 709 | state_free(s); |
| 710 | return NULL; |
| 711 | } |
| 712 | atomic_init(&s->registered, true); |
| 713 | s->interval_ms = POLL_BASE_MS; |
| 714 | return s; |
| 715 | } |
| 716 | |
| 717 | static void state_free(project_state_t *s) { |
| 718 | if (!s) { |
no test coverage detected