lkml.org 
[lkml]   [2010]   [Jun]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 15/16] trivial: use ARRAY_SIZE
On Mon, Jun 28, 2010 at 03:55:41PM +0400, Kulikov Vasiliy wrote:
> Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).
>
> Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
> ---
> drivers/staging/wlags49_h2/hcf.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/staging/wlags49_h2/hcf.c b/drivers/staging/wlags49_h2/hcf.c
> index 390628c..c4fe0ec 100644
> --- a/drivers/staging/wlags49_h2/hcf.c
> +++ b/drivers/staging/wlags49_h2/hcf.c
> @@ -502,7 +502,7 @@ HCF_STATIC hcf_16* BASED xxxx[ ] = {
> #endif // MSF_COMPONENT_ID
> NULL //endsentinel
> };
> -#define xxxx_PRI_IDENTITY_OFFSET (sizeof(xxxx)/sizeof(xxxx[0]) - 3)
> +#define xxxx_PRI_IDENTITY_OFFSET (ARRAY_SIZE(xxxx) - 3)
>

I would say the more critical problem with this macro is that it doesn't
work unless you name all your arrays "xxxx[]" so it encourages sub par
variable names.

You could do:
#define PRI_IDENTITY_OFFSET(x) (ARRAY_SIZE(x) - 3)

regards,
dan carpenter



\
 
 \ /
  Last update: 2010-06-28 14:57    [W:0.115 / U:0.088 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site