qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH qom-cpu v2 24/29] cpu: Drop qemu_for_each_cpu()


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH qom-cpu v2 24/29] cpu: Drop qemu_for_each_cpu()
Date: Sun, 16 Jun 2013 21:30:29 +0100

On 16 June 2013 21:26, Michael S. Tsirkin <address@hidden> wrote:
> On Sun, Jun 16, 2013 at 05:57:44PM +0200, Andreas Färber wrote:
>> Revert commit d6b9e0d60cc511eca210834428bb74508cff3d33 (cpu: Add
>> qemu_for_each_cpu()) and its usage in favor of open-coding CPU loops,
>> now that they are based on CPUState.
>>
>> Suggested-by: Markus Armbruster <address@hidden>
>> Signed-off-by: Andreas Färber <address@hidden>
>
> Open-coding is kind of nasty though.
>
> How about
> #define qemu_for_each_cpu(cpu) \
>     for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu)

Personally for an iteration that simple I would prefer
the opencoded version -- it's more immediately
obvious what it's doing and that it's not doing anything
weird.

Precedent isn't everything, but a quick grep for 'foreach'
and 'for_each' suggests that we generally use the callback-fn
style rather than iterator macros.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]