Skip to content

Commit f74c90d

Browse files
bk2204gitster
authored andcommitted
var: format variable structure with C99 initializers
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1e65721 commit f74c90d

File tree

1 file changed

+32
-8
lines changed

1 file changed

+32
-8
lines changed

builtin/var.c

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,38 @@ struct git_var {
4646
const char *(*read)(int);
4747
};
4848
static struct git_var git_vars[] = {
49-
{ "GIT_COMMITTER_IDENT", git_committer_info },
50-
{ "GIT_AUTHOR_IDENT", git_author_info },
51-
{ "GIT_EDITOR", editor },
52-
{ "GIT_SEQUENCE_EDITOR", sequence_editor },
53-
{ "GIT_PAGER", pager },
54-
{ "GIT_DEFAULT_BRANCH", default_branch },
55-
{ "GIT_SHELL_PATH", shell_path },
56-
{ "", NULL },
49+
{
50+
.name = "GIT_COMMITTER_IDENT",
51+
.read = git_committer_info,
52+
},
53+
{
54+
.name = "GIT_AUTHOR_IDENT",
55+
.read = git_author_info,
56+
},
57+
{
58+
.name = "GIT_EDITOR",
59+
.read = editor,
60+
},
61+
{
62+
.name = "GIT_SEQUENCE_EDITOR",
63+
.read = sequence_editor,
64+
},
65+
{
66+
.name = "GIT_PAGER",
67+
.read = pager,
68+
},
69+
{
70+
.name = "GIT_DEFAULT_BRANCH",
71+
.read = default_branch,
72+
},
73+
{
74+
.name = "GIT_SHELL_PATH",
75+
.read = shell_path,
76+
},
77+
{
78+
.name = "",
79+
.read = NULL,
80+
},
5781
};
5882

5983
static void list_vars(void)

0 commit comments

Comments
 (0)