aboutsummaryrefslogtreecommitdiff
path: root/newlib
diff options
context:
space:
mode:
authorXiao Zeng <zengxiao@eswincomputing.com>2023-12-15 16:31:01 +0800
committerJeff Johnston <jjohnstn@redhat.com>2023-12-19 23:23:31 -0500
commitb639245932726602394ddf91f60883184191a643 (patch)
tree1d47ca8bbbcf3d512810ab426fe77cf3bd5d294b /newlib
parentc1a61029fedbad16bfd6978be13d62412bdede49 (diff)
downloadnewlib-b639245932726602394ddf91f60883184191a643.zip
newlib-b639245932726602394ddf91f60883184191a643.tar.gz
newlib-b639245932726602394ddf91f60883184191a643.tar.bz2
newlib: libc: Improved the readability of strcspn with minor optimization
Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
Diffstat (limited to 'newlib')
-rw-r--r--newlib/libc/string/strcspn.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/newlib/libc/string/strcspn.c b/newlib/libc/string/strcspn.c
index abaa93a..8ac0bf1 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;
}