From patchwork Wed Dec 20 06:43:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiao Zeng X-Patchwork-Id: 82556 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C996738618B5 for ; Wed, 20 Dec 2023 06:45:02 +0000 (GMT) X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from sgoci-sdnproxy-4.icoremail.net (sgoci-sdnproxy-4.icoremail.net [129.150.39.64]) by sourceware.org (Postfix) with ESMTP id E2E9B385E019 for ; Wed, 20 Dec 2023 06:44:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E2E9B385E019 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=eswincomputing.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=eswincomputing.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E2E9B385E019 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=129.150.39.64 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703054693; cv=none; b=GpJ6hgzpUitb4ZlORc7hpQEfurhbfWHUzLlkSkH8CMlXXjF+HdOrlLgbuv6Sl4aRPPdMc7YzIHldQ92j0/tK7Bex3ES9FI84IJOwoZB51epl2sNj0oMymIcsBR9+pzU3+h2kltqAPymh4NMTxJgWiqNRq8WqV15Gz9EDO8osIIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1703054693; c=relaxed/simple; bh=LvHgi2RmfhBMyIgLYkjixibcx7VbNihckv7AW8OYkjU=; h=From:To:Subject:Date:Message-Id; b=SvgRDglLUB6M/V+mVH6A8A4UBlDHrd6zpSHEmLmqUi8aOd/PyrbzJg3s5R0TiNz+Js/LohxMzkZvQalksnuFYxTaNJt/ebwXnxgrFYScLGUT+6wB1mopdfj94vJf+GeuOaWfjfArErtIlfHmAu4ee+pJWixolmZ9ePh0IGU2fO4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (unknown [10.12.130.31]) by app2 (Coremail) with SMTP id TQJkCgB3BdQDjYJl4EoCAA--.22906S4; Wed, 20 Dec 2023 14:43:15 +0800 (CST) From: Xiao Zeng To: newlib@sourceware.org Cc: jjohnstn@redhat.com, palmer@rivosinc.com, jeffreyalaw@gmail.com, torbjorn.svensson@foss.st.com, Xiao Zeng Subject: [PATCH] newlib: libc: Improved the readability of strspn with minor optimization Date: Wed, 20 Dec 2023 14:43:40 +0800 Message-Id: <20231220064340.36505-1-zengxiao@eswincomputing.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: TQJkCgB3BdQDjYJl4EoCAA--.22906S4 X-Coremail-Antispam: 1UD129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUUY07AC8VAFwI0_Gr0_Xr1l1xkIjI8I6I8E 6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28Cjx kF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8I cVCY1x0267AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87 Iv6xkF7I0E14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE 6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72 CE4IkC6x0Yz7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7 MxkIecxEwVCm-wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c 02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_ Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7 CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v2 6r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0J UdHUDUUUUU= X-CM-SenderInfo: p2hqw5xldrqvxvzl0uprps33xlqjhudrp/ X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: newlib-bounces+patchwork=sourceware.org@sourceware.org Signed-off-by: Xiao Zeng --- 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++; }