Re: [PATCH wayland 6/8] fixup! scanner: use c99 initializers for the interface symbols

2018-07-03 Thread Pekka Paalanen
On Thu, 14 Jun 2018 16:49:43 +0100
Emil Velikov  wrote:

> ---
>  tests/data/example-code.c   | 124 
> +++-
>  tests/data/small-code-core.c|   6 +-
>  tests/data/small-code.c |   6 +-
>  tests/data/small-private-code.c |   6 +-
>  4 files changed, 67 insertions(+), 75 deletions(-)
> 
> diff --git a/tests/data/example-code.c b/tests/data/example-code.c
> index 4a41b8b..2e1f73b 100644
> --- a/tests/data/example-code.c
> +++ b/tests/data/example-code.c
> @@ -157,9 +157,9 @@ static const struct wl_message wl_display_events[] = {
>  };
>  
>  WL_EXPORT const struct wl_interface wl_display_interface = {
> - "wl_display", 1,
> - 2, wl_display_requests,
> - 2, wl_display_events,
> + .name = "wl_display", .version = 1,
> + .method_count = 2, .methods = wl_display_requests,
> + .event_count = 2, .events = wl_display_events,
>  };
>  

>  WL_EXPORT const struct wl_interface wl_callback_interface = {
> - "wl_callback", 1,
> - 0, NULL,
> - 1, wl_callback_events,
> + .name = "wl_callback", .version = 1,
> + .event_count = 1, .events = wl_callback_events,
>  };
>  
>  static const struct wl_message wl_compositor_requests[] = {
> @@ -193,9 +192,8 @@ static const struct wl_message wl_compositor_requests[] = 
> {
>  };
>  
>  WL_EXPORT const struct wl_interface wl_compositor_interface = {
> - "wl_compositor", 4,
> - 2, wl_compositor_requests,
> - 0, NULL,
> + .name = "wl_compositor", .version = 4,
> + .method_count = 2, .methods = wl_compositor_requests,
>  };

Hi,

this change seems more worthwhile than patches 3+4, because this is
already on multiple lines, the added length doesn't hurt that much, and
I think the field names are actually informative since there are more
fields. They are also not repeated so much. Getting rid of the NULL
entries is also nice in this case, maybe not so much for arrays where
one is looking at a range of elements and noticing the index skipping
NULL entries would be extra effort to read.

Acked-by: Pekka Paalanen 


Thanks,
pq


pgpz2DxyL1Ok_.pgp
Description: OpenPGP digital signature
___
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel


[PATCH wayland 6/8] fixup! scanner: use c99 initializers for the interface symbols

2018-06-14 Thread Emil Velikov
---
 tests/data/example-code.c   | 124 +++-
 tests/data/small-code-core.c|   6 +-
 tests/data/small-code.c |   6 +-
 tests/data/small-private-code.c |   6 +-
 4 files changed, 67 insertions(+), 75 deletions(-)

diff --git a/tests/data/example-code.c b/tests/data/example-code.c
index 4a41b8b..2e1f73b 100644
--- a/tests/data/example-code.c
+++ b/tests/data/example-code.c
@@ -157,9 +157,9 @@ static const struct wl_message wl_display_events[] = {
 };
 
 WL_EXPORT const struct wl_interface wl_display_interface = {
-   "wl_display", 1,
-   2, wl_display_requests,
-   2, wl_display_events,
+   .name = "wl_display", .version = 1,
+   .method_count = 2, .methods = wl_display_requests,
+   .event_count = 2, .events = wl_display_events,
 };
 
 static const struct wl_message wl_registry_requests[] = {
@@ -172,9 +172,9 @@ static const struct wl_message wl_registry_events[] = {
 };
 
 WL_EXPORT const struct wl_interface wl_registry_interface = {
-   "wl_registry", 1,
-   1, wl_registry_requests,
-   2, wl_registry_events,
+   .name = "wl_registry", .version = 1,
+   .method_count = 1, .methods = wl_registry_requests,
+   .event_count = 2, .events = wl_registry_events,
 };
 
 static const struct wl_message wl_callback_events[] = {
@@ -182,9 +182,8 @@ static const struct wl_message wl_callback_events[] = {
 };
 
 WL_EXPORT const struct wl_interface wl_callback_interface = {
-   "wl_callback", 1,
-   0, NULL,
-   1, wl_callback_events,
+   .name = "wl_callback", .version = 1,
+   .event_count = 1, .events = wl_callback_events,
 };
 
 static const struct wl_message wl_compositor_requests[] = {
@@ -193,9 +192,8 @@ static const struct wl_message wl_compositor_requests[] = {
 };
 
 WL_EXPORT const struct wl_interface wl_compositor_interface = {
-   "wl_compositor", 4,
-   2, wl_compositor_requests,
-   0, NULL,
+   .name = "wl_compositor", .version = 4,
+   .method_count = 2, .methods = wl_compositor_requests,
 };
 
 static const struct wl_message wl_shm_pool_requests[] = {
@@ -205,9 +203,8 @@ static const struct wl_message wl_shm_pool_requests[] = {
 };
 
 WL_EXPORT const struct wl_interface wl_shm_pool_interface = {
-   "wl_shm_pool", 1,
-   3, wl_shm_pool_requests,
-   0, NULL,
+   .name = "wl_shm_pool", .version = 1,
+   .method_count = 3, .methods = wl_shm_pool_requests,
 };
 
 static const struct wl_message wl_shm_requests[] = {
@@ -219,9 +216,9 @@ static const struct wl_message wl_shm_events[] = {
 };
 
 WL_EXPORT const struct wl_interface wl_shm_interface = {
-   "wl_shm", 1,
-   1, wl_shm_requests,
-   1, wl_shm_events,
+   .name = "wl_shm", .version = 1,
+   .method_count = 1, .methods = wl_shm_requests,
+   .event_count = 1, .events = wl_shm_events,
 };
 
 static const struct wl_message wl_buffer_requests[] = {
@@ -233,9 +230,9 @@ static const struct wl_message wl_buffer_events[] = {
 };
 
 WL_EXPORT const struct wl_interface wl_buffer_interface = {
-   "wl_buffer", 1,
-   1, wl_buffer_requests,
-   1, wl_buffer_events,
+   .name = "wl_buffer", .version = 1,
+   .method_count = 1, .methods = wl_buffer_requests,
+   .event_count = 1, .events = wl_buffer_events,
 };
 
 static const struct wl_message wl_data_offer_requests[] = {
@@ -253,9 +250,9 @@ static const struct wl_message wl_data_offer_events[] = {
 };
 
 WL_EXPORT const struct wl_interface wl_data_offer_interface = {
-   "wl_data_offer", 3,
-   5, wl_data_offer_requests,
-   3, wl_data_offer_events,
+   .name = "wl_data_offer", .version = 3,
+   .method_count = 5, .methods = wl_data_offer_requests,
+   .event_count = 3, .events = wl_data_offer_events,
 };
 
 static const struct wl_message wl_data_source_requests[] = {
@@ -274,9 +271,9 @@ static const struct wl_message wl_data_source_events[] = {
 };
 
 WL_EXPORT const struct wl_interface wl_data_source_interface = {
-   "wl_data_source", 3,
-   3, wl_data_source_requests,
-   6, wl_data_source_events,
+   .name = "wl_data_source", .version = 3,
+   .method_count = 3, .methods = wl_data_source_requests,
+   .event_count = 6, .events = wl_data_source_events,
 };
 
 static const struct wl_message wl_data_device_requests[] = {
@@ -295,9 +292,9 @@ static const struct wl_message wl_data_device_events[] = {
 };
 
 WL_EXPORT const struct wl_interface wl_data_device_interface = {
-   "wl_data_device", 3,
-   3, wl_data_device_requests,
-   6, wl_data_device_events,
+   .name = "wl_data_device", .version = 3,
+   .method_count = 3, .methods = wl_data_device_requests,
+   .event_count = 6, .events = wl_data_device_events,
 };
 
 static const struct wl_message wl_data_device_manager_requests[] = {
@@ -306,9 +303,8 @@ static const struct wl_message 
wl_data_device_manager_requests[] = {
 };
 
 WL_EXPORT const struct wl_interface