diff mbox series

[v5,14/15] diff: use designated initializers for emitted_diff_symbol

Message ID b88696596641eba8f2bd5c09869972874e642023.1639045810.git.gitgitgadget@gmail.com (mailing list archive)
State Accepted
Commit b4a5c5c419009c26935536fa7039ad5073acb237
Headers show
Series diff --color-moved[-ws] speedups | expand

Commit Message

Phillip Wood Dec. 9, 2021, 10:30 a.m. UTC
From: Phillip Wood <phillip.wood@dunelm.org.uk>

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>
---
 diff.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/diff.c b/diff.c
index 2085c063675..9ef88d7665a 100644
--- 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);