public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PING^1] [PATCH] newlib: libc: Improved the readability of strspn with minor optimization
@ 2024-01-02  5:56 Xiao Zeng
  2024-01-02 19:24 ` Jeff Johnston
  0 siblings, 1 reply; 3+ messages in thread
From: Xiao Zeng @ 2024-01-02  5:56 UTC (permalink / raw)
  To: newlib; +Cc: jjohnstn, palmer, jeffreyalaw, torbjorn.svensson, Xiao Zeng

Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
---
 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PING^1] [PATCH] newlib: libc: Improved the readability of strspn with minor optimization
  2024-01-02  5:56 [PING^1] [PATCH] newlib: libc: Improved the readability of strspn with minor optimization Xiao Zeng
@ 2024-01-02 19:24 ` Jeff Johnston
  2024-01-03  1:26   ` Xiao Zeng
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Johnston @ 2024-01-02 19:24 UTC (permalink / raw)
  To: Xiao Zeng; +Cc: newlib, palmer, jeffreyalaw, torbjorn.svensson

[-- Attachment #1: Type: text/plain, Size: 920 bytes --]

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 <zengxiao@eswincomputing.com>
wrote:

> Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
> ---
>  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
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PING^1] [PATCH] newlib: libc: Improved the readability of strspn with minor optimization
  2024-01-02 19:24 ` Jeff Johnston
@ 2024-01-03  1:26   ` Xiao Zeng
  0 siblings, 0 replies; 3+ messages in thread
From: Xiao Zeng @ 2024-01-03  1:26 UTC (permalink / raw)
  To: Jeff Johnston; +Cc: newlib, palmer, jeffreyalaw, Torbjorn SVENSSON

2024-01-03 03:24  Jeff Johnston <jjohnstn@redhat.com> wrote:
>
 
>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. 
Thank you Jeff, your modifications have made the code more meaningful.

>Modified code has been merged.
>
>-- Jeff J.
>
>On Tue, Jan 2, 2024 at 12:57 AM Xiao Zeng <zengxiao@eswincomputing.com>
>wrote:
>
>> Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
>> ---
>>  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
>>
>>
 
Thanks
Xiao Zeng


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-03  1:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-02  5:56 [PING^1] [PATCH] newlib: libc: Improved the readability of strspn with minor optimization Xiao Zeng
2024-01-02 19:24 ` Jeff Johnston
2024-01-03  1:26   ` Xiao Zeng

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 read-only IMAP folder(s) and NNTP newsgroup(s).