Re: [server PATCH 7/8] red_worker: use a generic SAFE_FOREACH macro

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

 



On 07/08/2013 01:57 PM, Christophe Fergeau wrote:
On Mon, Jul 08, 2013 at 01:32:29PM +0300, Uri Lublin wrote:
Introduce SAFE_FOREACH macro

Make other safe iterators use SAFE_FOREACH
There's already a RING_FOREACH_SAFE() macro in spice-common/ring.h, could
it be useful here?


Hi Christophe,


Thanks for the review.

These macros in red_worker.c are similar to using RING_FOREACH_SAFE, but
offer some convenience.

For example, the following are equivalent:
    RCC_FOREACH_SAFE(link, next, rcc, channel) {
        f(rcc);
    }

    ----------------

    if (channel)
    RING_FOREACH_SAFE(link, next, &(channel)->clients) {
        rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
        f(rcc);
    }



And the following are equivalent:
    WORKER_FOREACH_DCC_SAFE(worker, link, next, dcc) {
        g(dcc)
    }

    -------------------

    if (worker && worker->display_channel)
RING_FOREACH_SAFE(link, next, &(worker)->display_channel->common.base.clients) { dcc = SPICE_CONTAINEROF(link, DisplayChannelClient, common.base.channel_link);
        g(dcc);
    }


Thanks,
    Uri.
_______________________________________________
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]