public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] newlib: libc: Improved the readability of strspn with minor optimization
@ 2023-12-20  6:43 Xiao Zeng
  2023-12-20  6:46 ` Xiao Zeng
  0 siblings, 1 reply; 2+ messages in thread
From: Xiao Zeng @ 2023-12-20  6:43 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] 2+ messages in thread

end of thread, other threads:[~2023-12-20  6:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20  6:43 [PATCH] newlib: libc: Improved the readability of strspn with minor optimization Xiao Zeng
2023-12-20  6:46 ` 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).