All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ardelean, Alexandru" <alexandru.Ardelean-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
To: "kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org"
	<linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
	"cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
	<intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
	"linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"
	<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	"linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org"
	<devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org>,
	"linux-integrity-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-integrity-u79uwXL29Tb/PtFMR13I2A@public.gmane.org>
Cc: "gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org"
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	"andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org"
	<andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Subject: Re: [PATCH 01/16] lib: fix match_string() helper on -1 array size
Date: Wed, 8 May 2019 11:31:15 +0000	[thread overview]
Message-ID: <c8cfa5dbdfc0b0665d1b48f37ba57c3ec1233197.camel__29211.3176825055$1557315348$gmane$org@analog.com> (raw)
In-Reply-To: <20190508112842.11654-2-alexandru.ardelean-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>

On Wed, 2019-05-08 at 14:28 +0300, Alexandru Ardelean wrote:
> The documentation the `_match_string()` helper mentions that `n`
> should be:
>  * @n: number of strings in the array or -1 for NULL terminated arrays
> 
> The behavior of the function is different, in the sense that it exits on
> the first NULL element in the array, regardless of whether `n` is -1 or a
> positive number.
> 
> This patch changes the behavior, to exit the loop when a NULL element is
> found and n == -1. Essentially, this aligns the behavior with the
> doc-string.
> 
> There are currently many users of `match_string()`, and so, in order to
> go
> through them, the next patches in the series will focus on doing some
> cosmetic changes, which are aimed at grouping the users of
> `match_string()`.
> 

This is the duplicate & should be dropped.
Sorry for this.

> Signed-off-by: Alexandru Ardelean <alexandru.ardelean-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
> ---
>  lib/string.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/string.c b/lib/string.c
> index 3ab861c1a857..76edb7bf76cb 100644
> --- a/lib/string.c
> +++ b/lib/string.c
> @@ -648,8 +648,11 @@ int match_string(const char * const *array, size_t
> n, const char *string)
>  
>  	for (index = 0; index < n; index++) {
>  		item = array[index];
> -		if (!item)
> +		if (!item) {
> +			if (n != (size_t)-1)
> +				continue;
>  			break;
> +		}
>  		if (!strcmp(item, string))
>  			return index;
>  	}

  parent reply	other threads:[~2019-05-08 11:31 UTC|newest]

Thread overview: 211+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 11:28 [PATCH 00/16] treewide: fix match_string() helper when array size Alexandru Ardelean
2019-05-08 11:28 ` Alexandru Ardelean
2019-05-08 11:28 ` Alexandru Ardelean
2019-05-08 11:28 ` Alexandru Ardelean
2019-05-08 11:28 ` Alexandru Ardelean
2019-05-08 11:28 ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 01/16] lib: fix match_string() helper on -1 " Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
     [not found]   ` <20190508112842.11654-2-alexandru.ardelean-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
2019-05-08 11:31     ` Ardelean, Alexandru [this message]
2019-05-08 11:31   ` Ardelean, Alexandru
2019-05-08 11:31     ` Ardelean, Alexandru
2019-05-08 11:31     ` Ardelean, Alexandru
2019-05-08 11:31     ` Ardelean, Alexandru
2019-05-08 11:31     ` [alsa-devel] " Ardelean, Alexandru
2019-05-08 11:31     ` Ardelean, Alexandru
2019-05-08 11:31     ` Ardelean, Alexandru
2019-05-08 11:31     ` Ardelean, Alexandru
2019-05-08 11:31   ` Ardelean, Alexandru
2019-05-08 11:31   ` Ardelean, Alexandru
2019-05-08 11:28 ` [PATCH 01/16] lib: fix match_string() helper when array size is positive Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 02/16] treewide: rename match_string() -> __match_string() Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 17:00   ` Stephen Boyd
2019-05-09  8:52     ` Ardelean, Alexandru
2019-05-09 17:23       ` Stephen Boyd
2019-05-09  9:02     ` Heiko Stuebner
2019-05-08 11:28 ` [PATCH 03/16] lib,treewide: add new match_string() helper/macro Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 13:11   ` Andy Shevchenko
2019-05-08 13:11     ` Andy Shevchenko
2019-05-08 13:11     ` Andy Shevchenko
2019-05-08 13:11     ` Andy Shevchenko
2019-05-08 13:11     ` Andy Shevchenko
2019-05-08 13:11     ` Andy Shevchenko
2019-05-08 13:18     ` Greg KH
2019-05-08 13:18       ` Greg KH
2019-05-08 13:18       ` Greg KH
2019-05-08 13:18       ` Greg KH
2019-05-08 13:18       ` Greg KH
2019-05-08 13:18       ` [PATCH 03/16] lib, treewide: " Greg KH
2019-05-08 13:22       ` [PATCH 03/16] lib,treewide: " Ardelean, Alexandru
2019-05-08 13:22         ` Ardelean, Alexandru
2019-05-08 13:22         ` Ardelean, Alexandru
2019-05-08 13:22         ` Ardelean, Alexandru
2019-05-08 13:22         ` Ardelean, Alexandru
2019-05-08 13:22         ` Ardelean, Alexandru
2019-05-08 13:22         ` Ardelean, Alexandru
2019-05-08 13:22         ` Ardelean, Alexandru
2019-05-10  9:15         ` Ardelean, Alexandru
2019-05-10  9:15           ` Ardelean, Alexandru
2019-05-10  9:15           ` Ardelean, Alexandru
2019-05-10  9:15           ` Ardelean, Alexandru
2019-05-10  9:15           ` Ardelean, Alexandru
2019-05-10  9:15           ` Ardelean, Alexandru
2019-05-10  9:15           ` Ardelean, Alexandru
2019-05-10 14:34           ` andriy.shevchenko
2019-05-10 14:34             ` [PATCH 03/16] lib, treewide: " andriy.shevchenko
2019-05-10 14:34             ` [PATCH 03/16] lib,treewide: " andriy.shevchenko
2019-05-10 14:34             ` andriy.shevchenko
2019-05-10 14:34             ` andriy.shevchenko
2019-05-10 14:34             ` andriy.shevchenko
2019-05-10 14:34             ` andriy.shevchenko
2019-05-10 14:34             ` [PATCH 03/16] lib, treewide: " andriy.shevchenko
2019-05-13  7:00             ` [PATCH 03/16] lib,treewide: " Ardelean, Alexandru
2019-05-13  7:00               ` Ardelean, Alexandru
2019-05-13  7:00               ` Ardelean, Alexandru
2019-05-13  7:00               ` Ardelean, Alexandru
2019-05-13  7:00               ` Ardelean, Alexandru
2019-05-13  7:00               ` Ardelean, Alexandru
2019-05-13  7:00               ` Ardelean, Alexandru
2019-05-08 11:28 ` [PATCH 04/16] powerpc/xmon: use " Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 05/16] ALSA: oxygen: " Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 06/16] x86/mtrr: use new match_string() helper + add gaps == minor fix Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 07/16] device connection: use new match_string() helper/macro Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 08/16] cpufreq/intel_pstate: remove NULL entry + use match_string() Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 09/16] mmc: sdhci-xenon: use new match_string() helper/macro Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 12:20   ` Dan Carpenter
2019-05-08 12:20     ` Dan Carpenter
2019-05-08 12:20     ` Dan Carpenter
2019-05-08 12:20     ` Dan Carpenter
2019-05-08 12:20     ` Dan Carpenter
2019-05-08 13:26     ` Ardelean, Alexandru
2019-05-08 13:26       ` Ardelean, Alexandru
2019-05-08 13:26       ` Ardelean, Alexandru
2019-05-08 13:26       ` Ardelean, Alexandru
2019-05-08 13:26       ` Ardelean, Alexandru
2019-05-10  9:13       ` Ardelean, Alexandru
2019-05-10  9:13         ` Ardelean, Alexandru
2019-05-10  9:13         ` Ardelean, Alexandru
2019-05-10  9:13         ` Ardelean, Alexandru
2019-05-10  9:13         ` Ardelean, Alexandru
2019-05-10 11:01         ` Dan Carpenter
2019-05-10 11:01           ` Dan Carpenter
2019-05-10 11:01           ` Dan Carpenter
2019-05-10 11:01           ` Dan Carpenter
2019-05-10 11:01           ` Dan Carpenter
2019-05-10 11:04           ` Ardelean, Alexandru
2019-05-10 11:04             ` Ardelean, Alexandru
2019-05-10 11:04             ` Ardelean, Alexandru
2019-05-10 11:04             ` Ardelean, Alexandru
2019-05-10 11:04             ` Ardelean, Alexandru
2019-05-08 11:28 ` [PATCH 10/16] pinctrl: armada-37xx: " Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 11/16] mm/vmpressure.c: " Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 12/16] rdmacg: " Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 13/16] drm/edid: " Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 14/16] staging: gdm724x: " Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 15/16] video: fbdev: pxafb: " Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28 ` [PATCH 16/16] sched: debug: " Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-08 11:28   ` Alexandru Ardelean
2019-05-28  7:39 ` [PATCH 1/3][V2] lib: fix match_string() helper on -1 array size Alexandru Ardelean
2019-05-28  7:39   ` Alexandru Ardelean
2019-05-28  7:39   ` Alexandru Ardelean
2019-05-28  7:39   ` Alexandru Ardelean
2019-05-28  7:39   ` Alexandru Ardelean
2019-05-28  7:39   ` Alexandru Ardelean
2019-05-28  7:39   ` [PATCH 2/3][V2] treewide: rename match_string() -> __match_string() Alexandru Ardelean
2019-05-28  7:39     ` Alexandru Ardelean
2019-05-28  7:39     ` Alexandru Ardelean
2019-05-28  7:39     ` Alexandru Ardelean
2019-05-28  7:39     ` Alexandru Ardelean
2019-05-28  7:39     ` Alexandru Ardelean
2019-05-28  7:39   ` [PATCH 3/3][V2] lib: re-introduce new match_string() helper/macro Alexandru Ardelean
2019-05-28  7:39     ` Alexandru Ardelean
2019-05-28  7:39     ` Alexandru Ardelean
2019-05-28  7:39     ` Alexandru Ardelean
2019-05-28  7:39     ` Alexandru Ardelean
2019-05-28  7:39     ` Alexandru Ardelean
2019-05-28 23:36 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/3,V2] lib: fix match_string() helper on -1 array size Patchwork
2019-05-29  0:06 ` ✓ Fi.CI.BAT: success " Patchwork
2019-05-29  8:31 ` ✓ Fi.CI.IGT: " Patchwork

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='c8cfa5dbdfc0b0665d1b48f37ba57c3ec1233197.camel__29211.3176825055$1557315348$gmane$org@analog.com' \
    --to=alexandru.ardelean-oylxuock7orqt0dzr+alfa@public.gmane.org \
    --cc=andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-integrity-u79uwXL29Tb/PtFMR13I2A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=linux-mmc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-security-module-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.