[PATCH wayland 3/3] server: Use existing id variable when inserting created object

Bryce Harrington bryce at osg.samsung.com
Fri Jan 23 09:24:26 PST 2015


On Fri, Jan 23, 2015 at 04:21:15PM +0800, Jonas Ådahl wrote:
> We already have the id variable there and it makes it slightly easier to
> read.
> 
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
> ---
>  src/wayland-server.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/src/wayland-server.c b/src/wayland-server.c
> index c845dd6..cde1eef 100644
> --- a/src/wayland-server.c
> +++ b/src/wayland-server.c
> @@ -1313,11 +1313,10 @@ wl_resource_create(struct wl_client *client,
>  	resource->version = version;
>  	resource->dispatcher = NULL;
>  
> -	if (wl_map_insert_at(&client->objects, 0, resource->object.id, resource) < 0) {
> +	if (wl_map_insert_at(&client->objects, 0, id, resource) < 0) {
>  		wl_resource_post_error(client->display_resource,
>  				       WL_DISPLAY_ERROR_INVALID_OBJECT,
> -				       "invalid new id %d",
> -				       resource->object.id);
> +				       "invalid new id %d", id);

Right, just a few lines above this chunk we have:

        if (id == 0)
                id = wl_map_insert_new(&client->objects, 0, NULL);

        resource->object.id = id;

There is an intervening wl_signal_init() call, but that doesn't change
the object.id.

For the series:

Reviewed-by: Bryce Harrington <bryce at osg.samsung.com>

>  		free(resource);
>  		return NULL;
>  	}
> -- 
> 2.1.0
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list