summaryrefslogtreecommitdiff
path: root/ws.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2007-12-16 11:31:38 -0500
committerJunio C Hamano <gitster@pobox.com>2007-12-16 13:07:20 -0800
commit1020999a981e0dadedc475c41e33e20fd7832019 (patch)
tree0b0e1a7b4bb78e160a35ea9e2a2d10d8a081598d /ws.c
parent4d9697c7871e513712eb9cfd30611049b10e5132 (diff)
downloadgit-1020999a981e0dadedc475c41e33e20fd7832019.tar.gz
whitespace: reorganize initial-indent check
Reorganize to emphasize the most complicated part of the code (the tab case). Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ws.c')
-rw-r--r--ws.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/ws.c b/ws.c
index 5ebd1095a2..716587498c 100644
--- a/ws.c
+++ b/ws.c
@@ -146,16 +146,15 @@ unsigned check_and_emit_line(const char *line, int len, unsigned ws_rule,
/* Check for space before tab in initial indent. */
for (i = 0; i < len; i++) {
- if (line[i] == '\t') {
- if ((ws_rule & WS_SPACE_BEFORE_TAB) &&
- (leading_space != -1))
- result |= WS_SPACE_BEFORE_TAB;
- break;
- }
- else if (line[i] == ' ')
+ if (line[i] == ' ') {
leading_space = i;
- else
+ continue;
+ }
+ if (line[i] != '\t')
break;
+ if ((ws_rule & WS_SPACE_BEFORE_TAB) && (leading_space != -1))
+ result |= WS_SPACE_BEFORE_TAB;
+ break;
}
/* Check for indent using non-tab. */