Re: [PATCH] treewide: use size_t where applicable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
> ---
>  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.




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux