Thread (7 messages) flat view 7 messages, 2 authors, 2016-09-08
STALE3621d

Revision v1 of 2 in this series.

Revisions (2)
  1. v1 [diff vs current]
  2. v1 current

[PATCH 2/2] diff: remove dead code

From: Stefan Beller <hidden>
Date: 2016-09-07 23:37:18
Subsystem: the rest · Maintainer: Linus Torvalds

When `len < 1`, len has to be 0 or negative, emit_line will then remove the
first character and by then `len` would be negative. As this doesn't
happen, it is safe to assume it is dead code.

This continues to simplify the code, which was started in b8d9c1a66b
(2009-09-03,  diff.c: the builtin_diff() deals with only two-file
comparison).

Signed-off-by: Stefan Beller <redacted>
---
 diff.c | 8 --------
 1 file changed, 8 deletions(-)
diff --git a/diff.c b/diff.c
index 79ad91d..c143019 100644
--- a/diff.c
+++ b/diff.c
@@ -1251,14 +1251,6 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
 		return;
 	}
 
-	if (len < 1) {
-		emit_line(o, reset, reset, line, len);
-		if (ecbdata->diff_words
-		    && ecbdata->diff_words->type == DIFF_WORDS_PORCELAIN)
-			fputs("~\n", o->file);
-		return;
-	}
-
 	if (ecbdata->diff_words) {
 		if (line[0] == '-') {
 			diff_words_append(line, len,
-- 
2.10.0.2.g0676c79.dirty
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help