Skip to content

Commit e51a1dc

Browse files
avargitster
authored andcommitted
serve: use designated initializers
Change the declaration of the protocol_capability struct to use designated initializers, this makes this more verbose now, but a follow-up commit will add a new field. At that point these lines would be too dense to be on one line comfortably. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bd4eaa9 commit e51a1dc

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

serve.c

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,37 @@ struct protocol_capability {
7373
};
7474

7575
static struct protocol_capability capabilities[] = {
76-
{ "agent", agent_advertise, NULL },
77-
{ "ls-refs", ls_refs_advertise, ls_refs },
78-
{ "fetch", upload_pack_advertise, upload_pack_v2 },
79-
{ "server-option", always_advertise, NULL },
80-
{ "object-format", object_format_advertise, NULL },
81-
{ "session-id", session_id_advertise, NULL },
82-
{ "object-info", always_advertise, cap_object_info },
76+
{
77+
.name = "agent",
78+
.advertise = agent_advertise,
79+
},
80+
{
81+
.name = "ls-refs",
82+
.advertise = ls_refs_advertise,
83+
.command = ls_refs,
84+
},
85+
{
86+
.name = "fetch",
87+
.advertise = upload_pack_advertise,
88+
.command = upload_pack_v2,
89+
},
90+
{
91+
.name = "server-option",
92+
.advertise = always_advertise,
93+
},
94+
{
95+
.name = "object-format",
96+
.advertise = object_format_advertise,
97+
},
98+
{
99+
.name = "session-id",
100+
.advertise = session_id_advertise,
101+
},
102+
{
103+
.name = "object-info",
104+
.advertise = always_advertise,
105+
.command = cap_object_info,
106+
},
83107
};
84108

85109
static void advertise_capabilities(void)

0 commit comments

Comments
 (0)