Re: [server PATCH 6/8] red_worker: make CCC_FOREACH safe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/spice-devel

Attachment: pgpxwrNwaYc10.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]