Skip to content

Commit 22233d4

Browse files
avargitster
authored andcommitted
xdiff users: use designated initializers for out_line
Amend the code added in 611e42a (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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f97fe35 commit 22233d4

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

builtin/merge-tree.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,12 @@ static void show_diff(struct merge_list *entry)
107107
mmfile_t src, dst;
108108
xpparam_t xpp;
109109
xdemitconf_t xecfg;
110-
xdemitcb_t ecb;
110+
xdemitcb_t ecb = { .out_line = show_outf };
111111

112112
memset(&xpp, 0, sizeof(xpp));
113113
xpp.flags = 0;
114114
memset(&xecfg, 0, sizeof(xecfg));
115115
xecfg.ctxlen = 3;
116-
ecb.out_hunk = NULL;
117-
ecb.out_line = show_outf;
118-
ecb.priv = NULL;
119116

120117
src.ptr = origin(entry, &size);
121118
if (!src.ptr)

builtin/rerere.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static int diff_two(const char *file1, const char *label1,
2828
{
2929
xpparam_t xpp;
3030
xdemitconf_t xecfg;
31-
xdemitcb_t ecb;
31+
xdemitcb_t ecb = { .out_line = outf };
3232
mmfile_t minus, plus;
3333
int ret;
3434

@@ -41,8 +41,6 @@ static int diff_two(const char *file1, const char *label1,
4141
xpp.flags = 0;
4242
memset(&xecfg, 0, sizeof(xecfg));
4343
xecfg.ctxlen = 3;
44-
ecb.out_hunk = NULL;
45-
ecb.out_line = outf;
4644
ret = xdi_diff(&minus, &plus, &xpp, &xecfg, &ecb);
4745

4846
free(minus.ptr);

0 commit comments

Comments
 (0)