aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-09-06 07:23:31 +0800
committerGitHub <noreply@github.com>2024-09-06 07:23:31 +0800
commit9570ad24f52442d75d677412cfe2fa83a7ff7a88 (patch)
tree117fe98061b3f3045787a9f65f801084a19bcc21
parentd60c753cffc4a6e7a33e6c94a6ffbe5bbafad13b (diff)
downloadrneovim-9570ad24f52442d75d677412cfe2fa83a7ff7a88.tar.gz
rneovim-9570ad24f52442d75d677412cfe2fa83a7ff7a88.tar.bz2
rneovim-9570ad24f52442d75d677412cfe2fa83a7ff7a88.zip
vim-patch:9.1.0717: Unnecessary nextcmd NULL checks in parse_command_modifiers() (#30275)
Problem: Unnecessary nextcmd NULL checks in parse_command_modifiers(). Solution: Remove them (zeertzjq) Every place parse_command_modifiers() is called, nextcmd is NULL, and after it's set to non-NULL the function returns very soon. Even if one day nextcmd may be non-NULL, the NULL checks may still be wrong as the correct behavior may be overriding nextcmd. closes: vim/vim#15620 https://github.com/vim/vim/commit/f7b8609446f171a6a287f61564e39a8dac5ff47d
-rw-r--r--src/nvim/ex_docmd.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 80bc31a1d2..293aaac036 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -2500,15 +2500,13 @@ int parse_command_modifiers(exarg_T *eap, const char **errormsg, cmdmod_T *cmod,
// ignore comment and empty lines
if (*eap->cmd == '"') {
// a comment ends at a NL
- if (eap->nextcmd == NULL) {
- eap->nextcmd = vim_strchr(eap->cmd, '\n');
- if (eap->nextcmd != NULL) {
- eap->nextcmd++;
- }
+ eap->nextcmd = vim_strchr(eap->cmd, '\n');
+ if (eap->nextcmd != NULL) {
+ eap->nextcmd++;
}
return FAIL;
}
- if (eap->nextcmd == NULL && *eap->cmd == '\n') {
+ if (*eap->cmd == '\n') {
eap->nextcmd = eap->cmd + 1;
return FAIL;
}