[PATCH wayland v3 06/10] util: Pass flags to map iterators

Daniel Stone daniel at fooishbar.org
Wed Dec 27 14:26:31 UTC 2017


Hi,

On 6 December 2017 at 17:22, Derek Foreman <derekf at osg.samsung.com> wrote:
>  static enum wl_iterator_result
> -destroy_resource(void *element, void *data)
> +_destroy_resource(void *element, void *data, uint32_t flags)
>  {
>         struct wl_resource *resource = element;
> -       struct wl_client *client = resource->client;
> -       uint32_t flags;
>
>         wl_signal_emit(&resource->deprecated_destroy_signal, resource);
>         /* Don't emit the new signal for deprecated resources, as that would
> @@ -670,7 +668,6 @@ destroy_resource(void *element, void *data)
>         if (!resource_is_deprecated(resource))
>                 wl_priv_signal_emit(&resource->destroy_signal, resource);
>
> -       flags = wl_map_lookup_flags(&client->objects, resource->object.id);
>         if (resource->destroy)
>                 resource->destroy(resource);
>
> @@ -680,6 +677,18 @@ destroy_resource(void *element, void *data)
>         return WL_ITERATOR_CONTINUE;
>  }
>
> +static enum wl_iterator_result
> +destroy_resource(void *element, void *data)
> +{
> +       struct wl_resource *resource = element;
> +       struct wl_client *client = resource->client;
> +       uint32_t flags;
> +
> +       flags = wl_map_lookup_flags(&client->objects, resource->object.id);
> +
> +       return _destroy_resource(element, data, flags);
> +}

I know I already gave R-b for this, but on closer inspection I spied
there was only one destroy_resource() user at all, so I just inlined
the flag lookup into it and binned the wrapper. Hope that's OK.

Cheers,
Daniel


More information about the wayland-devel mailing list