Re: [PING^1] [PATCH] newlib: libc: Improved the readability of strspn with minor optimization

Jeff Johnston <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAOox84s3nZvvpM=h9LAMT6qMyGtZ-6xfA_DG49ewc__V5cojZg@mail.gmail.com>
Hello,

I modified the code to change the label to "found" instead of "end" since
"end" is usually used to jump to the end of function as opposed to loop.
Modified code has been merged.

-- Jeff J.

On Tue, Jan 2, 2024 at 12:57 AM Xiao Zeng <[email protected]>
wrote:

> Signed-off-by: Xiao Zeng <[email protected]>
> ---
>  newlib/libc/string/strspn.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/newlib/libc/string/strspn.c b/newlib/libc/string/strspn.c
> index baf239947..9d46ce2eb 100644
> --- a/newlib/libc/string/strspn.c
> +++ b/newlib/libc/string/strspn.c
> @@ -41,10 +41,11 @@ strspn (const char *s1,
>        for (c = s2; *c; c++)
>         {
>           if (*s1 == *c)
> -           break;
> +           goto end;
>         }
>        if (*c == '\0')
>         break;
> +end:
>        s1++;
>      }
>
> --
> 2.17.1
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.