diff options
author | John Marriott <basilisk@internode.on.net> | 2024-04-18 22:46:56 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2024-04-18 22:46:56 +0200 |
commit | ed908f760d9fe933690745bac91aedb698bbd48f (patch) | |
tree | d78084e2ae534fab468ba2c36edd73fec29ea4ca /src/ex_cmds.h | |
parent | 094c4390bdf3473fab122aa02883e63ce4e66cdb (diff) |
patch 9.1.0352: Finding cmd modifiers and cmdline-specials is inefficientv9.1.0352
Problem: Finding cmd modifiers and cmdline-specials is inefficient
Solution: Use binary search to find ex command modifiers and
cmdline-special characters and reduce the number of strlen()
(John Marriott)
closes: #14534
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/ex_cmds.h')
-rw-r--r-- | src/ex_cmds.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/ex_cmds.h b/src/ex_cmds.h index cb758aa7c3..70e57708f5 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -99,13 +99,14 @@ typedef struct exarg exarg_T; */ #ifdef DO_DECLARE_EXCMD # define EXCMD(a, b, c, d, e) \ - {(char_u *)b, c, (long_u)(d), e} + {(char_u *)b, STRLEN_LITERAL(b), c, (long_u)(d), e} typedef void (*ex_func_T) (exarg_T *eap); static struct cmdname { char_u *cmd_name; // name of the command + size_t cmd_namelen; // length of the command name ex_func_T cmd_func; // function for this command long_u cmd_argt; // flags declared above cmd_addr_T cmd_addr_type; // flag for address type |