[Spice-devel] [PATCH 03/18] server/red_worker: introduce CommonChannel
Marc-André Lureau
marcandre.lureau at gmail.com
Thu Feb 10 07:06:54 PST 2011
On Thu, Feb 10, 2011 at 3:54 PM, Alon Levy <alevy at redhat.com> wrote:
> I prefer CONTAINEROF. It's properly intimidating, and it checks that
> the cast-to struct has a field of the correct type, so it is much
> safer then just (X*). There is an UPCAST macro in use by qemu and kernel
> too I think that is basically the same as CONTAINEROF with the addition
> of enforcing an offset 0 of the base type, in effect the same as what
> you think as an upcast. We should probably add that and use it.
+1, that's exactly what I would use + some of kind of "optional" light
type checking if possible (iirc, PulseAudio has one)
> are later places where I have
> struct ChannelClient {
> RingItem client_link;
> RingItem channel_link;
> }
>
> So I actually need sometimes to do a CONTAINEROF with non zero offset (can't
> make both client_link and channel_link first in the list..)
oh sure, I was talking about class casting cases only.
regards
--
Marc-André Lureau
More information about the Spice-devel
mailing list