diff.c: adjust hash function signature to match hashmap expectation
This makes the follow up patch easier. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Jul 16, 2018 at 16:05 UTC
ee1df66f7cfd0f37bb0e235c4f7ef12bd09a8d2d
1 file changed
+9
-7
diff.c
+9
-7
@@ -707,11 +707,15 @@ struct moved_entry {
707
struct moved_entry *next_line;
708
};
709
710
-static int moved_entry_cmp(const struct diff_options *diffopt,
711
- const struct moved_entry *a,
712
- const struct moved_entry *b,
710
+static int moved_entry_cmp(const void *hashmap_cmp_fn_data,
711
+ const void *entry,
712
+ const void *entry_or_key,
713
const void *keydata)
714
{
715
+ const struct diff_options *diffopt = hashmap_cmp_fn_data;
716
+ const struct moved_entry *a = entry;
717
+ const struct moved_entry *b = entry_or_key;
718
+
719
return !xdiff_compare_lines(a->es->line, a->es->len,
720
b->es->line, b->es->len,
721
diffopt->xdl_opts);
@@ -5534,10 +5538,8 @@ static void diff_flush_patch_all_file_pairs(struct diff_options *o)
5538
if (o->color_moved) {
5539
struct hashmap add_lines, del_lines;
5540
5537
- hashmap_init(&del_lines,
5538
- (hashmap_cmp_fn)moved_entry_cmp, o, 0);
5539
- hashmap_init(&add_lines,
5540
- (hashmap_cmp_fn)moved_entry_cmp, o, 0);
5541
+ hashmap_init(&del_lines, moved_entry_cmp, o, 0);
5542
+ hashmap_init(&add_lines, moved_entry_cmp, o, 0);
5543
5544
add_lines_to_move_detection(o, &add_lines, &del_lines);
5545
mark_color_as_moved(o, &add_lines, &del_lines);