summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2021-12-09 10:30:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-12-09 21:24:06 (GMT)
commiteec7f53b3150dcc54ea0f4441587724be65c105d (patch)
tree1f9d91006dc430404028f04f6b45cef6df99df52 /diff.c
parent0e488f173257e5ab766267ac5a5c4c9f3f1ce343 (diff)
downloadgit-eec7f53b3150dcc54ea0f4441587724be65c105d.zip
git-eec7f53b3150dcc54ea0f4441587724be65c105d.tar.gz
git-eec7f53b3150dcc54ea0f4441587724be65c105d.tar.bz2
diff --color-moved: stop clearing potential moved blocks
moved_block_clear() was introduced in 74d156f4a1 ("diff --color-moved-ws: fix double free crash", 2018-10-04) to free the memory that was allocated when initializing a potential moved block. However since 21536d077f ("diff --color-moved-ws: modify allow-indentation-change", 2018-11-23) initializing a potential moved block no longer allocates any memory. Up until the last commit we were relying on moved_block_clear() to set the `match` pointer to NULL when a block stopped matching, but since that commit we do not clear a moved block that does not match so it does not make sense to clear them elsewhere. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c11
1 files changed, 0 insertions, 11 deletions
diff --git a/diff.c b/diff.c
index 626fd47..ffbe099 100644
--- a/diff.c
+++ b/diff.c
@@ -807,11 +807,6 @@ struct moved_block {
int wsd; /* The whitespace delta of this block */
};
-static void moved_block_clear(struct moved_block *b)
-{
- memset(b, 0, sizeof(*b));
-}
-
#define INDENT_BLANKLINE INT_MIN
static void fill_es_indent_data(struct emitted_diff_symbol *es)
@@ -1128,8 +1123,6 @@ static void mark_color_as_moved(struct diff_options *o,
}
if (pmb_nr && (!match || l->s != moved_symbol)) {
- int i;
-
if (!adjust_last_block(o, n, block_length) &&
block_length > 1) {
/*
@@ -1139,8 +1132,6 @@ static void mark_color_as_moved(struct diff_options *o,
match = NULL;
n -= block_length;
}
- for(i = 0; i < pmb_nr; i++)
- moved_block_clear(&pmb[i]);
pmb_nr = 0;
block_length = 0;
flipped_block = 0;
@@ -1193,8 +1184,6 @@ static void mark_color_as_moved(struct diff_options *o,
}
adjust_last_block(o, n, block_length);
- for(n = 0; n < pmb_nr; n++)
- moved_block_clear(&pmb[n]);
free(pmb);
}