summaryrefslogtreecommitdiffstats
path: root/src/if_cscope.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/if_cscope.c')
-rw-r--r--src/if_cscope.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/if_cscope.c b/src/if_cscope.c
index 3252ff4916..ffb1784e1b 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -221,25 +221,26 @@ set_context_in_cscope_cmd(
expand_what = (cmdidx == CMD_scscope)
? EXP_SCSCOPE_SUBCMD : EXP_CSCOPE_SUBCMD;
+ if (*arg == NUL)
+ return;
+
// (part of) subcommand already typed
- if (*arg != NUL)
- {
- p = skiptowhite(arg);
- if (*p != NUL) // past first word
- {
- xp->xp_pattern = skipwhite(p);
- if (*skiptowhite(xp->xp_pattern) != NUL)
- xp->xp_context = EXPAND_NOTHING;
- else if (STRNICMP(arg, "add", p - arg) == 0)
- xp->xp_context = EXPAND_FILES;
- else if (STRNICMP(arg, "kill", p - arg) == 0)
- expand_what = EXP_CSCOPE_KILL;
- else if (STRNICMP(arg, "find", p - arg) == 0)
- expand_what = EXP_CSCOPE_FIND;
- else
- xp->xp_context = EXPAND_NOTHING;
- }
- }
+ p = skiptowhite(arg);
+ if (*p == NUL)
+ return;
+
+ // past first word
+ xp->xp_pattern = skipwhite(p);
+ if (*skiptowhite(xp->xp_pattern) != NUL)
+ xp->xp_context = EXPAND_NOTHING;
+ else if (STRNICMP(arg, "add", p - arg) == 0)
+ xp->xp_context = EXPAND_FILES;
+ else if (STRNICMP(arg, "kill", p - arg) == 0)
+ expand_what = EXP_CSCOPE_KILL;
+ else if (STRNICMP(arg, "find", p - arg) == 0)
+ expand_what = EXP_CSCOPE_FIND;
+ else
+ xp->xp_context = EXPAND_NOTHING;
}
/*