From: Stefan Beller <sbeller@google.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Stefan Beller <sbeller@google.com>
Subject: [PATCH 2/2] diff: remove dead code
Date: Wed, 7 Sep 2016 16:36:47 -0700 [thread overview]
Message-ID: <20160907233648.5162-5-sbeller@google.com> (raw)
In-Reply-To: <20160907233648.5162-1-sbeller@google.com>
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 <sbeller@google.com>
---
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
next prev parent reply other threads:[~2016-09-07 23:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-07 23:36 [PATCH 0/3] preparatory diff improvements for moved color detection Stefan Beller
2016-09-07 23:36 ` [PATCH 1/3] diff.c: use diff_options directly Stefan Beller
2016-09-08 5:33 ` Jacob Keller
2016-09-07 23:36 ` [PATCH 1/2] diff: omit found pointer from emit_callback Stefan Beller
2016-09-07 23:36 ` [PATCH 2/3] " Stefan Beller
2016-09-08 20:53 ` Junio C Hamano
2016-09-07 23:36 ` Stefan Beller [this message]
2016-09-07 23:36 ` [PATCH 3/3] diff: remove dead code Stefan Beller
2016-09-08 21:07 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160907233648.5162-5-sbeller@google.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).