diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-01-12 12:33:30 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-01-12 12:33:30 +0000 |
commit | 0233bdfa2b487c392dc4fd1a29113e08fbace334 (patch) | |
tree | 83551e09979e7baa762cd11a65ddff2153883e4e /src/if_cscope.c | |
parent | 043d7b2c84cda275354aa023b5769660ea70a168 (diff) |
patch 9.0.1183: code is indented more than necessaryv9.0.1183
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11805)
Diffstat (limited to 'src/if_cscope.c')
-rw-r--r-- | src/if_cscope.c | 37 |
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; } /* |