patch 9.0.1183: code is indented more than necessary
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11805)
diff --git a/src/if_cscope.c b/src/if_cscope.c
index 3252ff4..ffb1784 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -221,25 +221,26 @@
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;
}
/*