[PATCH 1/2] builtin-apply: minor cleanup of whitespace detection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use 0 instead of -1 for the case where not tabs or spaces are found; it
will make some later math slightly simpler.

Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxxxxxx>
---
 builtin-apply.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/builtin-apply.c b/builtin-apply.c
index 2edd83b..bd94a4b 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -1550,8 +1550,8 @@ static int apply_line(char *output, const char *patch, int plen,
 	int i;
 	int add_nl_to_tail = 0;
 	int fixed = 0;
-	int last_tab_in_indent = -1;
-	int last_space_in_indent = -1;
+	int last_tab_in_indent = 0;
+	int last_space_in_indent = 0;
 	int need_fix_leading_space = 0;
 	char *buf;
 
@@ -1582,12 +1582,12 @@ static int apply_line(char *output, const char *patch, int plen,
 		if (ch == '\t') {
 			last_tab_in_indent = i;
 			if ((ws_rule & WS_SPACE_BEFORE_TAB) &&
-			    0 <= last_space_in_indent)
+			    0 < last_space_in_indent)
 			    need_fix_leading_space = 1;
 		} else if (ch == ' ') {
 			last_space_in_indent = i;
 			if ((ws_rule & WS_INDENT_WITH_NON_TAB) &&
-			    last_tab_in_indent < 0 &&
+			    last_tab_in_indent <= 0 &&
 			    8 <= i)
 				need_fix_leading_space = 1;
 		}
-- 
1.5.4.rc0.44.g21147

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux