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

Function ui_delete_fixture_init

tests/test_httpd.c:449–468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447} ui_delete_fixture_t;
448
449static int ui_delete_fixture_init(ui_delete_fixture_t *fx) {
450 memset(fx, 0, sizeof(*fx));
451 char *tmp = th_mktempdir("cbm_httpd_delete");
452 if (!tmp)
453 return -1;
454 snprintf(fx->tmpdir, sizeof(fx->tmpdir), "%s", tmp);
455 snprintf(fx->cache_dir, sizeof(fx->cache_dir), "%s/cache", fx->tmpdir);
456 snprintf(fx->root_dir, sizeof(fx->root_dir), "%s/root", fx->tmpdir);
457
458 const char *saved = getenv("CBM_CACHE_DIR");
459 fx->saved_cache_dir = saved ? strdup(saved) : NULL;
460 if (th_mkdir_p(fx->cache_dir) != 0 || th_mkdir_p(fx->root_dir) != 0) {
461 return -1;
462 }
463 cbm_setenv("CBM_CACHE_DIR", fx->cache_dir, 1);
464
465 fx->store = cbm_store_open_memory();
466 fx->watcher = cbm_watcher_new(fx->store, NULL, NULL);
467 return fx->store && fx->watcher ? 0 : -1;
468}
469
470static void ui_delete_fixture_cleanup(ui_delete_fixture_t *fx) {
471 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