[PATCH] newlib: libc: Improved the readability of strspn with minor optimization
Xiao Zeng
zengxiao@eswincomputing.com
Wed Dec 20 06:43:40 GMT 2023
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
More information about the Newlib
mailing list