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

Function ui_delete_fixture_init

tests/test_httpd.c:665–684  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

663} ui_delete_fixture_t;
664
665static int ui_delete_fixture_init(ui_delete_fixture_t *fx) {
666 memset(fx, 0, sizeof(*fx));
667 char *tmp = th_mktempdir("cbm_httpd_delete");
668 if (!tmp)
669 return -1;
670 snprintf(fx->tmpdir, sizeof(fx->tmpdir), "%s", tmp);
671 snprintf(fx->cache_dir, sizeof(fx->cache_dir), "%s/cache", fx->tmpdir);
672 snprintf(fx->root_dir, sizeof(fx->root_dir), "%s/root", fx->tmpdir);
673
674 const char *saved = getenv("CBM_CACHE_DIR");
675 fx->saved_cache_dir = saved ? strdup(saved) : NULL;
676 if (th_mkdir_p(fx->cache_dir) != 0 || th_mkdir_p(fx->root_dir) != 0) {
677 return -1;
678 }
679 cbm_setenv("CBM_CACHE_DIR", fx->cache_dir, 1);
680
681 fx->store = cbm_store_open_memory();
682 fx->watcher = cbm_watcher_new(fx->store, NULL, NULL);
683 return fx->store && fx->watcher ? 0 : -1;
684}
685
686static void ui_delete_fixture_cleanup(ui_delete_fixture_t *fx) {
687 if (fx->watcher)

Callers 1

test_httpd.cFile · 0.85

Calls 5

th_mktempdirFunction · 0.85
th_mkdir_pFunction · 0.85
cbm_setenvFunction · 0.85
cbm_store_open_memoryFunction · 0.85
cbm_watcher_newFunction · 0.85

Tested by

no test coverage detected