public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] newlib: libc: Improved the readability of strcspn with minor optimization
@ 2023-12-20 4:24 Jeff Johnston
0 siblings, 0 replies; only message in thread
From: Jeff Johnston @ 2023-12-20 4:24 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=b639245932726602394ddf91f60883184191a643
commit b639245932726602394ddf91f60883184191a643
Author: Xiao Zeng <zengxiao@eswincomputing.com>
Date: Fri Dec 15 16:31:01 2023 +0800
newlib: libc: Improved the readability of strcspn with minor optimization
Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
Diff:
---
newlib/libc/string/strcspn.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/newlib/libc/string/strcspn.c b/newlib/libc/string/strcspn.c
index abaa93ad6..8ac0bf10c 100644
--- a/newlib/libc/string/strcspn.c
+++ b/newlib/libc/string/strcspn.c
@@ -37,12 +37,10 @@ strcspn (const char *s1,
for (c = s2; *c; c++)
{
if (*s1 == *c)
- break;
+ goto end;
}
- if (*c)
- break;
s1++;
}
-
+end:
return s1 - s;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-12-20 4:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-20 4:24 [newlib-cygwin] newlib: libc: Improved the readability of strcspn with minor optimization Jeff Johnston
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).