From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2134) id 65CF03857BA2; Wed, 20 Dec 2023 04:24:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 65CF03857BA2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1703046243; bh=aGifqmO1XUyxqwZ0ONMA/osbbx809L5n8GTkRvTSgMw=; h=From:To:Subject:Date:From; b=JNATKQBl2VZZKzJDCvYbHUN/Pa45XKl09un0GDBG23QDgIjttkACx6nB+QRQ4P1QN uU0D+Nl3llA+XdXeM9dwAnlu6xurr/fvftjY2aGFMQMs+A2iHmomyBnQraN8M+JAHV gxLv62XJWDyD9WfjGD7PSfwJaiugZO/7pvLSKnd4= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Jeff Johnston To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] newlib: libc: Improved the readability of strcspn with minor optimization X-Act-Checkin: newlib-cygwin X-Git-Author: Xiao Zeng X-Git-Refname: refs/heads/master X-Git-Oldrev: c1a61029fedbad16bfd6978be13d62412bdede49 X-Git-Newrev: b639245932726602394ddf91f60883184191a643 Message-Id: <20231220042403.65CF03857BA2@sourceware.org> Date: Wed, 20 Dec 2023 04:24:03 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Db6392459327= 26602394ddf91f60883184191a643 commit b639245932726602394ddf91f60883184191a643 Author: Xiao Zeng Date: Fri Dec 15 16:31:01 2023 +0800 newlib: libc: Improved the readability of strcspn with minor optimizati= on =20 Signed-off-by: Xiao Zeng 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 =3D s2; *c; c++) { if (*s1 =3D=3D *c) - break; + goto end; } - if (*c) - break; s1++; } - +end: return s1 - s; }