Hi,
On 10 August 2014 12:27, Nils Chr. Brause <nilschrbra...@gmail.com> wrote: > On Sat, Aug 09, 2014 at 09:25:04AM -0400, Jasper St. Pierre wrote: > > > > I'm not a fan of this patch because it does a memset, and then a few > lines > > later, explicitly sets pointers to NULL. If you want a memset, you should > > also remove the explicit NULL sets. > > > > I agree. Here a new patch: > > From 685959fb80e6a1b10b2230efb331996bc38838ed Mon Sep 17 00:00:00 2001 > From: "Nils Chr. Brause" <nilschrbra...@googlemail.com> > Date: Fri, 8 Aug 2014 18:06:16 +0200 > Subject: [PATCH] wayland-client: Initialize newly created wl_proxys to > zero. > > Up until now, newly created wl_proxys (with proxy_create or > wl_proxy_create_for_id) are not initialized properly after memory > allocation. The wl_display object in contrast is. To prevent giving > uninitialized data to the user (e.g. user_data) an appropriate memset > has been added. Also, members don't have to be explicitly initialized > with NULL anymore. > > Signed-off-by: Nils Chr. Brause <nilschrbra...@googlemail.com> > --- > src/wayland-client.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/src/wayland-client.c b/src/wayland-client.c > index 3e401d3..04f478a 100644 > --- a/src/wayland-client.c > +++ b/src/wayland-client.c > @@ -274,9 +274,9 @@ proxy_create(struct wl_proxy *factory, const struct > wl_interface *interface) > if (proxy == NULL) > return NULL; > > + memset(proxy, 0, sizeof *proxy); > + > proxy->object.interface = interface; > - proxy->object.implementation = NULL; > - proxy->dispatcher = NULL; > proxy->display = display; > proxy->queue = factory->queue; > proxy->flags = 0; > After memset, this line can be removed as well. > @@ -331,10 +331,10 @@ wl_proxy_create_for_id(struct wl_proxy *factory, > if (proxy == NULL) > return NULL; > > + memset(proxy, 0, sizeof *proxy); > + > proxy->object.interface = interface; > - proxy->object.implementation = NULL; > proxy->object.id = id; > - proxy->dispatcher = NULL; > proxy->display = display; > proxy->queue = factory->queue; > proxy->flags = 0; > The same. -- > 2.0.4 > _______________________________________________ > wayland-devel mailing list > wayland-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/wayland-devel > With this the path is Reviewed-by: Marek Chalupa <mchqwe...@gmail.com> Regards, Marek
_______________________________________________ wayland-devel mailing list wayland-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/wayland-devel