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

Function dm_line_work

tests/test_doc_mentions.c:8539–8568  ·  view source on GitHub ↗

The same for DM_COST_REFS references in the documentation of a method that * shares its line with `members` - 1 other methods. */

Source from the content-addressed store, hash-verified

8537/* The same for DM_COST_REFS references in the documentation of a method that
8538 * shares its line with `members` - 1 other methods. */
8539static uint64_t dm_line_work(int members) {
8540 char *src = malloc(DM_COST_TEXT * 2);
8541 size_t cap = DM_COST_TEXT * 2;
8542 char tmp[256];
8543 snprintf(tmp, sizeof(tmp), "/tmp/cbm_dm_linecost_XXXXXX");
8544 if (!src || !cbm_mkdtemp(tmp)) {
8545 free(src);
8546 return 0;
8547 }
8548 size_t w = (size_t)snprintf(
8549 src, cap, "namespace Line\n{\n public class Wide\n {\n /// <summary>");
8550 for (int i = 0; i < DM_COST_REFS; i++) {
8551 w += (size_t)snprintf(src + w, cap - w, "<see cref=\"Nowhere%d\"/> ", i);
8552 }
8553 w += (size_t)snprintf(src + w, cap - w, "</summary>\n ");
8554 for (int i = 0; i < members; i++) {
8555 w += (size_t)snprintf(src + w, cap - w, " public void M%d() { }", i);
8556 }
8557 snprintf(src + w, cap - w, "\n }\n}\n");
8558 th_write_file(TH_PATH(tmp, "src/Wide.cs"), src);
8559 free(src);
8560 char db[512];
8561 snprintf(db, sizeof(db), "%s/cost.db", tmp);
8562 cbm_doclink_cs_test_work_reset();
8563 uint64_t work = dm_index(tmp, db, NULL) == 0 ? cbm_doclink_cs_test_work() : 0;
8564 int rows = dm_count(db, "SELECT COUNT(*) FROM doc_link_unresolved");
8565 dm_unlink_db(db);
8566 th_rmtree(tmp);
8567 return rows == DM_COST_REFS ? work : 0;
8568}
8569
8570enum { DM_TREE_FILES = 120 };
8571

Callers 1

Calls 8

cbm_mkdtempFunction · 0.85
th_write_fileFunction · 0.85
dm_indexFunction · 0.85
cbm_doclink_cs_test_workFunction · 0.85
dm_countFunction · 0.85
dm_unlink_dbFunction · 0.85
th_rmtreeFunction · 0.85

Tested by

no test coverage detected