From cac643f0f5c8efb41a83deda2fdea669fff4f0e3 Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 7 May 2026 16:55:30 +0800 Subject: [PATCH] refactor(excmd): remove duplicate get_cmd_argt (#39643) Problem: `excmd_get_argt` and `get_cmd_argt` do the same thing. Solution: Drop `get_cmd_argt` and update its callers to use `excmd_get_argt`. (cherry picked from commit 1fd82615b163adc5aca593a92d78d00eee2bc268) --- src/nvim/api/command.c | 2 +- src/nvim/ex_docmd.c | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c index 22b163a69b..c4bc29f1ab 100644 --- a/src/nvim/api/command.c +++ b/src/nvim/api/command.c @@ -442,7 +442,7 @@ String nvim_cmd(uint64_t channel_id, Dict(cmd) *cmd, Dict(cmd_opts) *opts, Arena } else if (!IS_USER_CMDIDX(ea.cmdidx)) { // Get the command flags so that we can know what type of arguments the command uses. // Not required for a user command since `find_ex_command` already deals with it in that case. - ea.argt = get_cmd_argt(ea.cmdidx); + ea.argt = excmd_get_argt(ea.cmdidx); } // Track whether the first argument was interpreted as count to avoid conflicts diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index d3f3288246..9531fc34c7 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -8651,12 +8651,6 @@ void verify_command(char *cmd) " `nW", a); } -/// Get argt of command with id -uint32_t get_cmd_argt(cmdidx_T cmdidx) -{ - return cmdnames[(int)cmdidx].cmd_argt; -} - /// Check if a command is a :map/:abbrev command. bool is_map_cmd(cmdidx_T cmdidx) {