From: Dan Carpenter <error27@gmail.com>
To: Kulikov Vasiliy <segooon@gmail.com>
Cc: trivial@kernel.org,
Kernel Janitors <kernel-janitors@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@suse.de>,
Henk de Groot <pe1dnn@amsat.org>, Joe Perches <joe@perches.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 15/16] trivial: use ARRAY_SIZE
Date: Mon, 28 Jun 2010 14:52:24 +0200 [thread overview]
Message-ID: <20100628125224.GJ19184@bicker> (raw)
In-Reply-To: <1277726143-24899-1-git-send-email-segooon@gmail.com>
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
next prev parent reply other threads:[~2010-06-28 12:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-28 11:55 [PATCH 15/16] trivial: use ARRAY_SIZE Kulikov Vasiliy
2010-06-28 12:52 ` Dan Carpenter [this message]
2010-06-28 13:15 ` Kulikov Vasiliy
2010-06-28 13:24 ` Dan Carpenter
2010-06-28 20:43 ` Henk de Groot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100628125224.GJ19184@bicker \
--to=error27@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@suse.de \
--cc=joe@perches.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pe1dnn@amsat.org \
--cc=segooon@gmail.com \
--cc=trivial@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox