Skip to content

Commit

Permalink
whitespace: reorganize initial-indent check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
J. Bruce Fields authored and gitster committed Dec 16, 2007
1 parent 4d9697c commit 1020999
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions ws.c
Expand Up @@ -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. */
Expand Down

0 comments on commit 1020999

Please sign in to comment.