[Spice-devel] [server PATCH 6/8] red_worker: make CCC_FOREACH safe
Christophe Fergeau
cfergeau at redhat.com
Mon Jul 8 03:58:24 PDT 2013
On Mon, Jul 08, 2013 at 01:32:28PM +0300, Uri Lublin wrote:
> Even though it is not used, it's better to make it safe (or remove it).
I'd either remove it, or fold that patch into the next one (ie silently
make it safe by switching to SAFE_FOREACH)
Christophe
> ---
> server/red_worker.c | 12 +++++++-----
> 1 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 72e5ea5..1f239c5 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -1157,12 +1157,14 @@ static inline uint64_t red_now(void);
> (next) = (link) ? ring_next(&drawable->glz_ring, (link)) : NULL,\
> glz = (link) ? SPICE_CONTAINEROF((link), RedGlzDrawable, drawable_link) : NULL)
>
> -#define CCC_FOREACH(link, ccc, channel) \
> +#define CCC_FOREACH_SAFE(link, next, ccc, channel) \
> for (link = ring_get_head(&(channel)->clients),\
> - ccc = SPICE_CONTAINEROF(link, CommonChannelClient, base.channel_link);\
> - (link); \
> - (link) = ring_next(&(channel)->clients, link),\
> - ccc = SPICE_CONTAINEROF(link, CommonChannelClient, base.channel_link))
> + (next) = (link) ? ring_next(&(channel)->clients, (link)) : NULL, \
> + ccc = SPICE_CONTAINEROF(link, CommonChannelClient, base.channel_link);\
> + (link); \
> + (link) = (next), \
> + (next) = (link) ? ring_next(&(channel)->clients, (link)) : NULL, \
> + ccc = SPICE_CONTAINEROF(link, CommonChannelClient, base.channel_link))
>
> #define DCC_TO_WORKER(dcc) \
> (SPICE_CONTAINEROF((dcc)->common.base.channel, CommonChannel, base)->worker)
> --
> 1.7.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130708/d3c7a41a/attachment.pgp>
More information about the Spice-devel
mailing list