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

Function undo_scope

src/pipeline/doc_links_cs.c:6104–6123  ·  view source on GitHub ↗

Take back what the file's scope set in the shared tables: the names it * quarantined, the flags it set on namespaces that were there before it, and * the namespaces it made. */

Source from the content-addressed store, hash-verified

6102 * quarantined, the flags it set on namespaces that were there before it, and
6103 * the namespaces it made. */
6104static void undo_scope(cs_index_t *ix) {
6105 cs_undo_t *u = &ix->undo;
6106 for (int i = u->nmarks - SKIP_ONE; i >= 0; i--) {
6107 cbm_ht_delete(u->marks[i].ht, u->marks[i].key);
6108 }
6109 for (int i = u->nflags - SKIP_ONE; i >= 0; i--) {
6110 ix->nss[u->flags[i].ns].declared = u->flags[i].declared;
6111 ix->nss[u->flags[i].ns].prod = u->flags[i].prod;
6112 }
6113 for (int id = ix->nnss - SKIP_ONE; id >= u->nnss; id--) {
6114 char key[CS_NAME_BUF + CBM_SZ_16];
6115 const cs_ns_t *n = &ix->nss[id];
6116 if (ns_key(key, sizeof(key), n->parent, n->name, strlen(n->name))) {
6117 cbm_ht_delete(ix->ns_by_key, key);
6118 }
6119 }
6120 ix->nnss = u->nnss;
6121 u->nflags = 0;
6122 u->nmarks = 0;
6123}
6124
6125/* Scope line fields (0-based, the tag is field 0; internal/cbm/doclink_cs.c):
6126 * `U region kind alias target`, `T region start end kind outer name tparams

Callers 1

build_filesFunction · 0.85

Calls 2

cbm_ht_deleteFunction · 0.85
ns_keyFunction · 0.85

Tested by

no test coverage detected