[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 1/2] diff: fix -B with single line changes
From:       Aaro Koskinen <aaro.koskinen () iki ! fi>
Date:       2015-07-30 20:13:25
Message-ID: 1438287206-28383-1-git-send-email-aaro.koskinen () iki ! fi
[Download RAW message or body]

Fix -B with single line changes. They were always ignored regardless
if they were blank or not.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
---
 editors/diff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/editors/diff.c b/editors/diff.c
index cf14b1d..e0adcee 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -658,8 +658,8 @@ static bool diff(FILE* fp[2], char *file[2])
 				}
 
 				for (j = 0; j < 2; j++)
-					for (k = v[j].a; k < v[j].b; k++)
-						nonempty |= (ix[j][k+1] - ix[j][k] != 1);
+					for (k = v[j].a; k <= v[j].b; k++)
+						nonempty |= (ix[j][k] - ix[j][k - 1] != 1);
 
 				vec = xrealloc_vector(vec, 6, ++idx);
 				memcpy(vec[idx], v, sizeof(v));
-- 
2.4.0

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic