[PATCH wayland 5/8] scanner: use c99 initializers for the interface symbols

Emil Velikov emil.l.velikov at gmail.com
Thu Jun 14 15:49:42 UTC 2018


From: Emil Velikov <emil.velikov at collabora.com>

Provides some clarity and removes the unnecessary zero/NULL
initialization.

Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 src/scanner.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/scanner.c b/src/scanner.c
index fb3c808..22b1daa 100644
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -1786,20 +1786,16 @@ emit_code(struct protocol *protocol, enum visibility vis)
 
 		printf("%s const struct wl_interface "
 		       "%s_interface = {\n"
-		       "\t\"%s\", %d,\n",
+		       "\t.name = \"%s\", .version = %d,\n",
 		       symbol_visibility, i->name, i->name, i->version);
 
 		if (!wl_list_empty(&i->request_list))
-			printf("\t%d, %s_requests,\n",
+			printf("\t.method_count = %d, .methods = %s_requests,\n",
 			       wl_list_length(&i->request_list), i->name);
-		else
-			printf("\t0, NULL,\n");
 
 		if (!wl_list_empty(&i->event_list))
-			printf("\t%d, %s_events,\n",
+			printf("\t.event_count = %d, .events = %s_events,\n",
 			       wl_list_length(&i->event_list), i->name);
-		else
-			printf("\t0, NULL,\n");
 
 		printf("};\n\n");
 
-- 
2.16.0



More information about the wayland-devel mailing list