From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Rob Herring <robh@kernel.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] efi/libstub: add strrchr function
Date: Thu, 1 Mar 2018 15:48:43 +0000 [thread overview]
Message-ID: <CAKv+Gu-sAQ6x8uCNtQjVrc4tzF7FyCBva8A92-Nxc=ciJj1eLA@mail.gmail.com> (raw)
In-Reply-To: <20180301152744.30718-1-robh@kernel.org>
On 1 March 2018 at 15:27, Rob Herring <robh@kernel.org> wrote:
> libfdt gained a new dependency on strrchr, so copy the implementation
> from lib/string.c.
>
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Signed-off-by: Rob Herring <robh@kernel.org>
> ---
> Please ack. This is a dependency for dtc/libfdt sync with upstream.
>
> drivers/firmware/efi/libstub/string.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/firmware/efi/libstub/string.c b/drivers/firmware/efi/libstub/string.c
> index ed10e3f602c5..c1a7e58a5af7 100644
> --- a/drivers/firmware/efi/libstub/string.c
> +++ b/drivers/firmware/efi/libstub/string.c
> @@ -56,3 +56,20 @@ int strncmp(const char *cs, const char *ct, size_t count)
> return 0;
> }
> #endif
> +
> +#ifndef __HAVE_ARCH_STRRCHR
As discussed over IRC, this #ifndef needs to be dropped.
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> +/**
> + * strrchr - Find the last occurrence of a character in a string
> + * @s: The string to be searched
> + * @c: The character to search for
> + */
> +char *strrchr(const char *s, int c)
> +{
> + const char *last = NULL;
> + do {
> + if (*s == (char)c)
> + last = s;
> + } while (*s++);
> + return (char *)last;
> +}
> +#endif
> --
> 2.14.1
>
prev parent reply other threads:[~2018-03-01 15:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 15:27 [PATCH] efi/libstub: add strrchr function Rob Herring
2018-03-01 15:48 ` Ard Biesheuvel [this message]
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='CAKv+Gu-sAQ6x8uCNtQjVrc4tzF7FyCBva8A92-Nxc=ciJj1eLA@mail.gmail.com' \
--to=ard.biesheuvel@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@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).