Skip to content

Commit 141b25a

Browse files
committed
fix(mcp): do not shadow cache_dir() in the ignore_worktrees reader
cppcheck 2.20 (the CI version) reports shadowFunction: the local cache_dir in cbm_mcp_ignore_worktrees_runtime_enabled() shadows the static cache_dir() helper in mcp.c. Rename the local to store_dir; no behavior change. Signed-off-by: Martin Vogel <[email protected]>
1 parent 1976986 commit 141b25a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎src/mcp/mcp.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21589,18 +21589,18 @@ bool cbm_mcp_ignore_worktrees_runtime_enabled(const cbm_mcp_server_t *srv) {
2158921589
if (srv && srv->config) {
2159021590
return cbm_mcp_ignore_worktrees_enabled(srv);
2159121591
}
21592-
const char *cache_dir = cbm_resolve_cache_dir();
21593-
if (!cache_dir) {
21592+
const char *store_dir = cbm_resolve_cache_dir();
21593+
if (!store_dir) {
2159421594
return false;
2159521595
}
2159621596
char store_path[CBM_SZ_4K];
21597-
int written = snprintf(store_path, sizeof(store_path), "%s/" CBM_CONFIG_DB_FILENAME, cache_dir);
21597+
int written = snprintf(store_path, sizeof(store_path), "%s/" CBM_CONFIG_DB_FILENAME, store_dir);
2159821598
cbm_path_info_t info;
2159921599
if (written < 0 || (size_t)written >= sizeof(store_path) ||
2160021600
cbm_path_info_utf8(store_path, &info) != CBM_PATH_INFO_OK || !info.is_regular) {
2160121601
return false;
2160221602
}
21603-
cbm_config_t *config = cbm_config_open(cache_dir);
21603+
cbm_config_t *config = cbm_config_open(store_dir);
2160421604
bool enabled = config && cbm_config_get_bool(config, CBM_CONFIG_IGNORE_WORKTREES, false);
2160521605
cbm_config_close(config);
2160621606
return enabled;

0 commit comments

Comments
 (0)