linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH] treewide: use size_t where applicable
Date: Tue, 8 Mar 2022 23:54:58 +0800	[thread overview]
Message-ID: <20220308155458.GA72687@sol> (raw)
In-Reply-To: <20220308152233.493098-1-brgl@bgdev.pl>

On Tue, Mar 08, 2022 at 04:22:33PM +0100, Bartosz Golaszewski wrote:
> size_t is the unsigned integer type generally used whenever variables
> define sizes, ranges and numbers of elements. Use it throughout the
> C library wherever it makes sense.
> 
> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> ---
>  include/gpiod.h      | 30 +++++++++++++++---------------
>  lib/chip.c           |  4 ++--
>  lib/edge-event.c     | 12 ++++++------
>  lib/internal.h       |  2 +-
>  lib/line-config.c    |  4 ++--
>  lib/line-request.c   | 10 +++++-----
>  lib/request-config.c | 12 ++++++------
>  tools/gpiodetect.c   |  2 +-
>  tools/gpioget.c      |  3 ++-
>  tools/gpioinfo.c     |  2 +-
>  tools/gpiomon.c      |  4 ++--
>  tools/gpioset.c      |  3 ++-
>  12 files changed, 45 insertions(+), 43 deletions(-)
> 
> diff --git a/include/gpiod.h b/include/gpiod.h
> index 0512a8f..e6a4645 100644

[snip]

> diff --git a/tools/gpioget.c b/tools/gpioget.c
> index 112257c..28030fa 100644
> --- a/tools/gpioget.c
> +++ b/tools/gpioget.c
> @@ -44,12 +44,13 @@ int main(int argc, char **argv)
>  	int direction = GPIOD_LINE_DIRECTION_INPUT;
>  	int optc, opti, bias = 0, ret, *values;
>  	struct gpiod_request_config *req_cfg;
> -	unsigned int *offsets, i, num_lines;
>  	struct gpiod_line_request *request;
>  	struct gpiod_line_config *line_cfg;
> +	unsigned int *offsets, i;
>  	struct gpiod_chip *chip;
>  	bool active_low = false;
>  	char *device, *end;
> +	size_t num_lines;
>  

Also makes sense for indicies into arrays, such as the i here and
elsewhere?
I'm guessing there is a lot of elsewhere.

Cheers,
Kent.


  reply	other threads:[~2022-03-08 15:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 15:22 [PATCH] treewide: use size_t where applicable Bartosz Golaszewski
2022-03-08 15:54 ` Kent Gibson [this message]
2022-03-08 20:26   ` Bartosz Golaszewski
2022-03-09  1:25     ` Kent Gibson
2022-03-09  8:32       ` Bartosz Golaszewski

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=20220308155458.GA72687@sol \
    --to=warthog618@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.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;
as well as URLs for NNTP newsgroup(s).