Re: [PATCH] removes array_size duplicates

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andrew Morton <akpm@...>
Cc: roel <12o3l@...>, lkml <linux-kernel@...>
Date: Monday, October 1, 2007 - 5:48 am

On Mon, 1 Oct 2007, Andrew Morton wrote:


among other things, one of the creepy issues here is the definition in
include/linux/netfilter/xt_sctp.h of the macro:

...
#define SCTP_CHUNKMAP_COPY(destmap, srcmap)                     \
        do {                                                    \
                int i;                                          \
                for (i = 0; i < ELEMCOUNT(chunkmap); i++)       \
                        destmap[i] = srcmap[i];                 \
        } while (0)
...

  i'm not a big fan of macros that refer to objects that aren't
parameters to the macro, especially when all the rest of them *do*.

rday

p.s.  ELEMCOUNT is simply an alternative to ARRAY_SIZE, which could
certainly be rewritten that way.

-- 
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================
-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] removes array_size duplicates, roel, (Thu Sep 27, 6:51 pm)
Re: [PATCH] removes array_size duplicates, Andrew Morton, (Mon Oct 1, 5:26 am)
Re: [PATCH] removes array_size duplicates, Robert P. J. Day, (Mon Oct 1, 5:48 am)
Re: [PATCH] removes array_size duplicates, Robert P. J. Day, (Mon Oct 1, 5:55 am)
Re: [PATCH] removes array_size duplicates, Geert Uytterhoeven, (Mon Oct 1, 5:33 am)
Re: [PATCH] removes array_size duplicates, Andrew Morton, (Mon Oct 1, 5:39 am)