From 99f3898dfcdcd5de1a3a6093d24ed097291ff4d8 Mon Sep 17 00:00:00 2001 From: Xiao Zeng Date: Tue, 2 Jan 2024 13:56:15 +0800 Subject: newlib: libc: Improved the readability of strspn with minor optimization Signed-off-by: Xiao Zeng --- newlib/libc/string/strspn.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'newlib/libc') diff --git a/newlib/libc/string/strspn.c b/newlib/libc/string/strspn.c index baf239947..bfa3331cd 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 found; } if (*c == '\0') break; +found: s1++; } -- cgit v1.2.3