summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2021-08-09 18:47:42 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-08-10 11:37:36 -0700
commit47ac23d31483fa8f942117fa5e0c0a70572e9e59 (patch)
tree1550bdcd31ae1559e5b7f1aa163c176e6ca264d0
parentGit 2.32 (diff)
downloadtgif-47ac23d31483fa8f942117fa5e0c0a70572e9e59.tar.xz
range-diff: drop useless "offset" variable from read_patches()
The "offset" variable was was introduced in 44b67cb62b (range-diff: split lines manually, 2019-07-11), but it has never done anything useful. We use it to count up the number of bytes we've consumed, but we never look at the result. It was probably copied accidentally from an almost-identical loop in apply.c:find_header() (and the point of that commit was to make use of the parse_git_diff_header() function which underlies both). Because the variable was set but not used, most compilers didn't seem to notice, but the upcoming clang-14 does complain about it, via its -Wunused-but-set-variable warning. Signed-off-by: Jeff King <peff@peff.net> Acked-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--range-diff.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/range-diff.c b/range-diff.c
index 1a4471fe4c..85ce535336 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -49,7 +49,7 @@ static int read_patches(const char *range, struct string_list *list,
struct patch_util *util = NULL;
int in_header = 1;
char *line, *current_filename = NULL;
- int offset, len;
+ int len;
size_t size;
strvec_pushl(&cp.args, "log", "--no-color", "-p", "--no-merges",
@@ -86,7 +86,7 @@ static int read_patches(const char *range, struct string_list *list,
line = contents.buf;
size = contents.len;
- for (offset = 0; size > 0; offset += len, size -= len, line += len) {
+ for (; size > 0; size -= len, line += len) {
const char *p;
len = find_end_of_line(line, size);