lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f17812d70809181138xb0e4d4bs8a6361bb038b5a6e@mail.gmail.com>
Date:	Fri, 19 Sep 2008 02:38:21 +0800
From:	"Eric Miao" <eric.y.miao@...il.com>
To:	"Alexey Dobriyan" <adobriyan@...il.com>
Cc:	"Ben Dooks" <ben-linux@...ff.org>, linux-kernel@...r.kernel.org,
	linux-arm-kernel@...ts.arm.linux.org.uk
Subject: Re: kernel.h: add ARRAY_AND_SIZE() macro to complement ARRAY_SIZE().

On Thu, Sep 18, 2008 at 11:06 PM, Alexey Dobriyan <adobriyan@...il.com> wrote:
> On Thu, Sep 18, 2008 at 02:24:47PM +0100, Ben Dooks wrote:
>> Move the ARRAY_AND_SIZE() macro from arch/arm/mach-pxa/generic.h
>> to a more useful position in include/linux/kernel.h. This macro
>> is very useful to registration functions that take an array and
>> the number of array elements in it as consecutive arguments.
>>
>> The macro also should ensure that mistakes where the wrong array
>> is used to the ARRAY_SIZE() macro is passed. It also makes it
>> easier to avoid wrapping registration function arguments.
>
>> --- linux-2.6.27-rc6-quilt4.orig/include/linux/kernel.h
>> +++ linux-2.6.27-rc6-quilt4/include/linux/kernel.h
>> @@ -43,6 +43,7 @@ extern const char linux_proc_banner[];
>>  #define IS_ALIGNED(x, a)             (((x) & ((typeof(x))(a) - 1)) == 0)
>>
>>  #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
>> +#define ARRAY_AND_SIZE(arr) (arr), ARRAY_SIZE(arr)
>
> Just like ARRAY_SIZE, it is misnamed.
>

Any hint about the correct spelling?

> And it isn't obvious to what it expands. Hopefully arm people will
> remove it. :-)

This is handy to use, saving several key strokes and making the line
shorter. If it's not obvious to what it expands, there must be some
fix for it?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ