On Tue, 2010-03-30 at 12:10 +0200, Gerd Hoffmann wrote: > Hi, > > This is a early, RfC patch series for a spice interface redesign. > For now only VDInterface, CoreInterface and KeyboardInterface are > touched. I'm sending them now to gather comments on the general > direction and design.
Also, some specific comments: +#ifndef container_of +#define container_of(ptr, type, member) ({ \ + const typeof(((type *) 0)->member) *__mptr = (ptr); \ + (type *) ((char *) __mptr - offsetof(type, member));}) +#endif You can use SPICE_CONTAINEROF from <spice/macros.h> + if (!is) + is = spice_malloc0(sizeof(*is)); You can use spice_new0(SpiceInterfaceState, 1) which is imho easier to read (as its more obvious what type is created without having to go look at the variable declaration). It does the casting of the newly allocated object too, which is nice for C++ code (for the client or common code). -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Alexander Larsson Red Hat, Inc al...@redhat.com alexander.lars...@gmail.com He's an impetuous ninja card sharp with acid for blood. She's a supernatural Bolivian socialite from beyond the grave. They fight crime! _______________________________________________ Spice-devel mailing list Spice-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/spice-devel