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>
This commit is contained in:
parent
4d9697c787
commit
1020999a98
15
ws.c
15
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. */
|
/* Check for space before tab in initial indent. */
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
if (line[i] == '\t') {
|
if (line[i] == ' ') {
|
||||||
if ((ws_rule & WS_SPACE_BEFORE_TAB) &&
|
|
||||||
(leading_space != -1))
|
|
||||||
result |= WS_SPACE_BEFORE_TAB;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (line[i] == ' ')
|
|
||||||
leading_space = i;
|
leading_space = i;
|
||||||
else
|
continue;
|
||||||
|
}
|
||||||
|
if (line[i] != '\t')
|
||||||
break;
|
break;
|
||||||
|
if ((ws_rule & WS_SPACE_BEFORE_TAB) && (leading_space != -1))
|
||||||
|
result |= WS_SPACE_BEFORE_TAB;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for indent using non-tab. */
|
/* Check for indent using non-tab. */
|
||||||
|
Loading…
Reference in New Issue
Block a user