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 <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Aug 5, 2021 at 03:25 UTC
85baaed4757860eb54e6451be305bfb7ef863646
1 file changed
+31
-7
serve.c
+31
-7
@@ -73,13 +73,37 @@ struct protocol_capability {
73
};
74
75
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
+ },
107
};
108
109
static void advertise_capabilities(void)