]> git.ipfire.org Git - thirdparty/git.git/commitdiff
var: format variable structure with C99 initializers
authorbrian m. carlson <bk2204@github.com>
Tue, 27 Jun 2023 16:18:58 +0000 (16:18 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Jun 2023 18:31:06 +0000 (11:31 -0700)
Right now, we have only two items in our variable struct.  However, in
the future, we're going to add two more items.  To help keep our diffs
nice and tidy and make this structure easier to read, switch to use
C99-style initializers for our data.

Signed-off-by: brian m. carlson <bk2204@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/var.c

index bd340c5717dcab6b00c546e96dbb8b0759ae322b..379564a399d6ca293960a2d9560c4f8418e2dea1 100644 (file)
@@ -46,14 +46,38 @@ struct git_var {
        const char *(*read)(int);
 };
 static struct git_var git_vars[] = {
-       { "GIT_COMMITTER_IDENT", git_committer_info },
-       { "GIT_AUTHOR_IDENT",   git_author_info },
-       { "GIT_EDITOR", editor },
-       { "GIT_SEQUENCE_EDITOR", sequence_editor },
-       { "GIT_PAGER", pager },
-       { "GIT_DEFAULT_BRANCH", default_branch },
-       { "GIT_SHELL_PATH", shell_path },
-       { "", NULL },
+       {
+               .name = "GIT_COMMITTER_IDENT",
+               .read = git_committer_info,
+       },
+       {
+               .name = "GIT_AUTHOR_IDENT",
+               .read = git_author_info,
+       },
+       {
+               .name = "GIT_EDITOR",
+               .read = editor,
+       },
+       {
+               .name = "GIT_SEQUENCE_EDITOR",
+               .read = sequence_editor,
+       },
+       {
+               .name = "GIT_PAGER",
+               .read = pager,
+       },
+       {
+               .name = "GIT_DEFAULT_BRANCH",
+               .read = default_branch,
+       },
+       {
+               .name = "GIT_SHELL_PATH",
+               .read = shell_path,
+       },
+       {
+               .name = "",
+               .read = NULL,
+       },
 };
 
 static void list_vars(void)