]> git.ipfire.org Git - thirdparty/git.git/commitdiff
diff: use designated initializers for emitted_diff_symbol
authorPhillip Wood <phillip.wood@dunelm.org.uk>
Thu, 9 Dec 2021 10:30:08 +0000 (10:30 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 9 Dec 2021 21:24:06 +0000 (13:24 -0800)
This makes it clearer which fields are being explicitly initialized
and will simplify the next commit where we add a new field to the
struct.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c

diff --git a/diff.c b/diff.c
index 2085c063675cb8dc8747d9bf977531845ce2fadf..9ef88d7665a53d54d7ba454df788b854ebbe669b 100644 (file)
--- a/diff.c
+++ b/diff.c
@@ -1497,7 +1497,9 @@ static void emit_diff_symbol_from_struct(struct diff_options *o,
 static void emit_diff_symbol(struct diff_options *o, enum diff_symbol s,
                             const char *line, int len, unsigned flags)
 {
-       struct emitted_diff_symbol e = {line, len, flags, 0, 0, s};
+       struct emitted_diff_symbol e = {
+               .line = line, .len = len, .flags = flags, .s = s
+       };
 
        if (o->emitted_symbols)
                append_emitted_diff_symbol(o, &e);