xdiff users: use designated initializers for out_line
Amend the code added in 611e42a5980 (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>
Ævar Arnfjörð Bjarmason committed
Apr 12, 2021 at 19:15 UTC
22233d43eb5479d1076e034eb5cdba973fa2b02a
2 files changed
+2
-7
builtin/merge-tree.c
+1
-4
@@ -107,15 +107,12 @@ static void show_diff(struct merge_list *entry)
107
mmfile_t src, dst;
108
xpparam_t xpp;
109
xdemitconf_t xecfg;
110
- xdemitcb_t ecb;
110
+ xdemitcb_t ecb = { .out_line = show_outf };
111
112
memset(&xpp, 0, sizeof(xpp));
113
xpp.flags = 0;
114
memset(&xecfg, 0, sizeof(xecfg));
115
xecfg.ctxlen = 3;
116
- ecb.out_hunk = NULL;
117
- ecb.out_line = show_outf;
118
- ecb.priv = NULL;
116
117
src.ptr = origin(entry, &size);
118
if (!src.ptr)
builtin/rerere.c
+1
-3
@@ -28,7 +28,7 @@ static int diff_two(const char *file1, const char *label1,
28
{
29
xpparam_t xpp;
30
xdemitconf_t xecfg;
31
- xdemitcb_t ecb;
31
+ xdemitcb_t ecb = { .out_line = outf };
32
mmfile_t minus, plus;
33
int ret;
34
@@ -41,8 +41,6 @@ static int diff_two(const char *file1, const char *label1,
41
xpp.flags = 0;
42
memset(&xecfg, 0, sizeof(xecfg));
43
xecfg.ctxlen = 3;
44
- ecb.out_hunk = NULL;
45
- ecb.out_line = outf;
44
ret = xdi_diff(&minus, &plus, &xpp, &xecfg, &ecb);
45
46
free(minus.ptr);