mirror of
https://github.com/DeusData/codebase-memory-mcp.git
synced 2026-11-04 10:48:20 +00:00
Satisfy lint for the new extraction recursion helpers
Whitelist find_first_descendant_by_kind and find_first_descendant_of in recursion_whitelist.h (bounded AST-depth DFS, like the existing r_collect_imports entry), and narrow two cppcheck-flagged variable scopes in sqlite_writer.c: use w->project at its single use, and fclose the value-copied wc.fp after free(w) instead of a pre-captured fp.
This commit is contained in:
1 parent
863bb70c94
commit
8a5c992bd2
2 files changed
+8
-5
No files matched your search
@@ -1917,7 +1917,6 @@ static int write_db_after_nodes(write_db_ctx_t *w, uint32_t nodes_root) {
|
||||
int node_count = w->node_count;
|
||||
CBMDumpEdge *edges = w->edges;
|
||||
int edge_count = w->edge_count;
|
||||
const char *project = w->project;
|
||||
|
||||
// Phase 1 (cont.): remaining data tables (edge + vector + token_vector records)
|
||||
CBM_PROF_START(t_data);
|
||||
@@ -2021,7 +2020,7 @@ static int write_db_after_nodes(write_db_ctx_t *w, uint32_t nodes_root) {
|
||||
// 1 row: project name
|
||||
RecordBuilder r;
|
||||
rec_init(&r);
|
||||
rec_add_text(&r, project);
|
||||
rec_add_text(&r, w->project);
|
||||
rec_add_int(&r, FIRST_ROWID); /* rowid */
|
||||
int plen = 0;
|
||||
uint8_t *payload = rec_finalize(&r, &plen);
|
||||
@@ -2205,10 +2204,9 @@ int cbm_writer_finalize(cbm_db_writer_t *w, const char *project, const char *roo
|
||||
w->wc.token_vec_count = token_vec_count;
|
||||
|
||||
write_db_ctx_t wc = w->wc; /* value copy survives free(w) */
|
||||
FILE *fp = w->wc.fp;
|
||||
free(w);
|
||||
if (err != 0) {
|
||||
(void)fclose(fp);
|
||||
(void)fclose(wc.fp); /* wc is a value copy, valid after free(w) */
|
||||
return err;
|
||||
}
|
||||
return write_db_after_nodes(&wc, nodes_root);
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
* R import scanner (bounded by source-file AST depth):
|
||||
* - r_collect_imports
|
||||
*
|
||||
* Extraction descendant search (bounded by AST depth):
|
||||
* - find_first_descendant_by_kind (Verilog/SystemVerilog name wrappers)
|
||||
* - find_first_descendant_of (Dart/Zig import URI/string nesting)
|
||||
*
|
||||
* To add a function: add it below AND add NOLINT(misc-no-recursion) on
|
||||
* the function definition line. The lint gate verifies both match.
|
||||
*/
|
||||
@@ -25,4 +29,5 @@
|
||||
"parse_or_expr", "parse_xor_expr", "parse_and_expr", "parse_not_expr", "parse_atom_expr", \
|
||||
"parse_post_where", "cbm_parse", "eval_expr", "glob_match", "glob_match_star", \
|
||||
"glob_match_doublestar", "glob_match_doublestar_slash", "glob_match_doublestar_any", \
|
||||
"parse_bool_expr", "parse_bool_atom", "r_collect_imports"
|
||||
"parse_bool_expr", "parse_bool_atom", "r_collect_imports", \
|
||||
"find_first_descendant_by_kind", "find_first_descendant_of"
|
||||
Reference in new issue
Block a user