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

Pekka Paalanen ppaalanen at gmail.com
Tue Jul 3 11:36:56 UTC 2018


On Thu, 14 Jun 2018 16:49:43 +0100
Emil Velikov <emil.l.velikov at gmail.com> 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 <pekka.paalanen at collabora.co.uk>


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20180703/28cd2daa/attachment.sig>


More information about the wayland-devel mailing list