1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-08 16:46:35 +02:00

xdiff users: use designated initializers for out_line

Amend the code added in 611e42a598 (xdiff: provide a separate emit
callback for hunks, 2018-11-02) to be more readable by using
designated initializers.

This changes "priv" in rerere.c to be initialized to NULL as we did in
merge-tree.c. That's not needed as we'll only use it if the callback
is defined, but being consistent here is better and less verbose.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Ævar Arnfjörð Bjarmason 2021-04-12 19:15:28 +02:00 committed by Junio C Hamano
parent f97fe35857
commit 22233d43eb
2 changed files with 2 additions and 7 deletions

View File

@ -107,15 +107,12 @@ static void show_diff(struct merge_list *entry)
mmfile_t src, dst;
xpparam_t xpp;
xdemitconf_t xecfg;
xdemitcb_t ecb;
xdemitcb_t ecb = { .out_line = show_outf };
memset(&xpp, 0, sizeof(xpp));
xpp.flags = 0;
memset(&xecfg, 0, sizeof(xecfg));
xecfg.ctxlen = 3;
ecb.out_hunk = NULL;
ecb.out_line = show_outf;
ecb.priv = NULL;
src.ptr = origin(entry, &size);
if (!src.ptr)

View File

@ -28,7 +28,7 @@ static int diff_two(const char *file1, const char *label1,
{
xpparam_t xpp;
xdemitconf_t xecfg;
xdemitcb_t ecb;
xdemitcb_t ecb = { .out_line = outf };
mmfile_t minus, plus;
int ret;
@ -41,8 +41,6 @@ static int diff_two(const char *file1, const char *label1,
xpp.flags = 0;
memset(&xecfg, 0, sizeof(xecfg));
xecfg.ctxlen = 3;
ecb.out_hunk = NULL;
ecb.out_line = outf;
ret = xdi_diff(&minus, &plus, &xpp, &xecfg, &ecb);
free(minus.ptr);