From: Ard Biesheuvel <ardb@kernel.org>
To: laniel_francis@privacyrequired.com
Cc: linux-efi <linux-efi@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v1 07/12] efi: Replace strstarts() by str_has_prefix().
Date: Fri, 4 Dec 2020 18:07:11 +0100 [thread overview]
Message-ID: <CAMj1kXEQhT_LF5FDBO3-S7pBn55wG59bQUVr2q58A4FhqodY8Q@mail.gmail.com> (raw)
In-Reply-To: <20201204170319.20383-8-laniel_francis@privacyrequired.com>
On Fri, 4 Dec 2020 at 18:06, <laniel_francis@privacyrequired.com> wrote:
>
> From: Francis Laniel <laniel_francis@privacyrequired.com>
>
> The two functions indicates if a string begins with a given prefix.
> The only difference is that strstarts() returns a bool while str_has_prefix()
> returns the length of the prefix if the string begins with it or 0 otherwise.
>
Why?
> Signed-off-by: Francis Laniel <laniel_francis@privacyrequired.com>
> ---
> drivers/firmware/efi/libstub/efi-stub-helper.c | 2 +-
> drivers/firmware/efi/libstub/gop.c | 10 +++++-----
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
> index aa8da0a49829..a502f549d900 100644
> --- a/drivers/firmware/efi/libstub/efi-stub-helper.c
> +++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
> @@ -230,7 +230,7 @@ efi_status_t efi_parse_options(char const *cmdline)
> if (parse_option_str(val, "debug"))
> efi_loglevel = CONSOLE_LOGLEVEL_DEBUG;
> } else if (!strcmp(param, "video") &&
> - val && strstarts(val, "efifb:")) {
> + val && str_has_prefix(val, "efifb:")) {
> efi_parse_option_graphics(val + strlen("efifb:"));
> }
> }
> diff --git a/drivers/firmware/efi/libstub/gop.c b/drivers/firmware/efi/libstub/gop.c
> index ea5da307d542..fbe95b3cc96a 100644
> --- a/drivers/firmware/efi/libstub/gop.c
> +++ b/drivers/firmware/efi/libstub/gop.c
> @@ -39,7 +39,7 @@ static bool parse_modenum(char *option, char **next)
> {
> u32 m;
>
> - if (!strstarts(option, "mode="))
> + if (!str_has_prefix(option, "mode="))
> return false;
> option += strlen("mode=");
> m = simple_strtoull(option, &option, 0);
> @@ -65,10 +65,10 @@ static bool parse_res(char *option, char **next)
> h = simple_strtoull(option, &option, 10);
> if (*option == '-') {
> option++;
> - if (strstarts(option, "rgb")) {
> + if (str_has_prefix(option, "rgb")) {
> option += strlen("rgb");
> pf = PIXEL_RGB_RESERVED_8BIT_PER_COLOR;
> - } else if (strstarts(option, "bgr")) {
> + } else if (str_has_prefix(option, "bgr")) {
> option += strlen("bgr");
> pf = PIXEL_BGR_RESERVED_8BIT_PER_COLOR;
> } else if (isdigit(*option))
> @@ -90,7 +90,7 @@ static bool parse_res(char *option, char **next)
>
> static bool parse_auto(char *option, char **next)
> {
> - if (!strstarts(option, "auto"))
> + if (!str_has_prefix(option, "auto"))
> return false;
> option += strlen("auto");
> if (*option && *option++ != ',')
> @@ -103,7 +103,7 @@ static bool parse_auto(char *option, char **next)
>
> static bool parse_list(char *option, char **next)
> {
> - if (!strstarts(option, "list"))
> + if (!str_has_prefix(option, "list"))
> return false;
> option += strlen("list");
> if (*option && *option++ != ',')
> --
> 2.20.1
>
next prev parent reply other threads:[~2020-12-04 17:08 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-04 17:03 [RFC PATCH v1 00/12] Replace strstarts() by str_has_prefix() laniel_francis
2020-12-04 17:03 ` [RFC PATCH v1 01/12] arm: " laniel_francis
2020-12-04 17:03 ` [RFC PATCH v1 02/12] mips: " laniel_francis
2020-12-04 17:03 ` [RFC PATCH v1 03/12] crypto: " laniel_francis
2020-12-04 17:03 ` [RFC PATCH v1 04/12] device-mapper: " laniel_francis
2020-12-04 17:03 ` [RFC PATCH v1 05/12] renesas: " laniel_francis
2020-12-04 17:03 ` [RFC PATCH v1 06/12] omap: " laniel_francis
2020-12-04 17:03 ` [RFC PATCH v1 07/12] efi: " laniel_francis
2020-12-04 17:07 ` Ard Biesheuvel [this message]
2020-12-04 17:19 ` Francis Laniel
2020-12-04 18:02 ` James Bottomley
2020-12-05 19:08 ` Francis Laniel
2020-12-05 19:36 ` Ard Biesheuvel
2020-12-05 20:24 ` James Bottomley
2020-12-05 20:57 ` Ard Biesheuvel
2020-12-05 21:15 ` James Bottomley
2020-12-05 21:20 ` Ard Biesheuvel
2020-12-05 23:04 ` James Bottomley
2020-12-07 15:10 ` Steven Rostedt
2020-12-07 16:25 ` David Laight
2020-12-05 20:28 ` Rasmus Villemoes
2020-12-10 18:14 ` Arvind Sankar
2020-12-11 9:45 ` David Laight
2020-12-11 16:10 ` Arvind Sankar
2020-12-04 17:03 ` [RFC PATCH v1 08/12] ide: " laniel_francis
2020-12-04 17:03 ` [RFC PATCH v1 09/12] mips: " laniel_francis
2020-12-04 17:03 ` [RFC PATCH v1 10/12] module: " laniel_francis
2020-12-04 17:03 ` [RFC PATCH v1 11/12] musb: " laniel_francis
2020-12-04 17:03 ` [RFC PATCH v1 12/12] string.h: Remove strstarts() laniel_francis
2020-12-04 17:56 ` [RFC PATCH v1 00/12] Replace strstarts() by str_has_prefix() James Bottomley
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=CAMj1kXEQhT_LF5FDBO3-S7pBn55wG59bQUVr2q58A4FhqodY8Q@mail.gmail.com \
--to=ardb@kernel.org \
--cc=laniel_francis@privacyrequired.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@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).