Message ID | 20240102055615.29320-1-zengxiao@eswincomputing.com |
---|---|
State | New |
Headers |
Return-Path: <newlib-bounces+patchwork=sourceware.org@sourceware.org> 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 63D323858419 for <patchwork@sourceware.org>; Tue, 2 Jan 2024 05:58:30 +0000 (GMT) X-Original-To: newlib@sourceware.org Delivered-To: newlib@sourceware.org Received: from zg8tmtu5ljg5lje1ms4xmtka.icoremail.net (zg8tmtu5ljg5lje1ms4xmtka.icoremail.net [159.89.151.119]) by sourceware.org (Postfix) with ESMTP id 128933858C41 for <newlib@sourceware.org>; Tue, 2 Jan 2024 05:57:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 128933858C41 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 128933858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=159.89.151.119 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704175083; cv=none; b=NYgLtLvu98St5tnh2FDApfnL3vfPAZuuYQppG+hbCE3vquYho1Jl3d93ntmC0VjCSsta4ccVGQ6v6vsuLBOkbMxCZ3r3v+UOtjYGLcUlI33Z7JZ3aNkvIND84SGyWP4iKqjvETrg9F2mFyO95iw2nJtO0WwqGxuYJ7+ru0A2uis= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704175083; c=relaxed/simple; bh=LvHgi2RmfhBMyIgLYkjixibcx7VbNihckv7AW8OYkjU=; h=From:To:Subject:Date:Message-Id; b=SH3t9xVfii5IOHARQKpfDSGY7VKuV3hn9C6XnfVs961w0ydls3yDJPYwDzoexYRKUjqe/YK3vsFJHsxWZN6QkrlT7JwY9cTCYYS3XeFO7PLMzHosGhJA8qQQLGVBvkwfmgJItvUpuhB4CSbzzZBCJNrukx9LyWgUrmzwHN6B2uQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from localhost.localdomain (unknown [10.12.130.31]) by app2 (Coremail) with SMTP id TQJkCgBHydJ0pZNlNgkEAA--.2924S4; Tue, 02 Jan 2024 13:56:04 +0800 (CST) From: Xiao Zeng <zengxiao@eswincomputing.com> To: newlib@sourceware.org Cc: jjohnstn@redhat.com, palmer@rivosinc.com, jeffreyalaw@gmail.com, torbjorn.svensson@foss.st.com, Xiao Zeng <zengxiao@eswincomputing.com> Subject: [PING^1] [PATCH] newlib: libc: Improved the readability of strspn with minor optimization Date: Tue, 2 Jan 2024 13:56:15 +0800 Message-Id: <20240102055615.29320-1-zengxiao@eswincomputing.com> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: TQJkCgBHydJ0pZNlNgkEAA--.2924S4 X-Coremail-Antispam: 1UD129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7v73 VFW2AGmfu7bjvjm3AaLaJ3UjIYCTnIWjp_UUUY17AC8VAFwI0_Gr0_Xr1l1xkIjI8I6I8E 6xAIw20EY4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l8cAvFVAK0II2c7xJM28Cjx kF64kEwVA0rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8I cVCY1x0267AKxVWxJr0_GcWl84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2js IEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE 5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeV CFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1l c2xSY4AK6svPMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I 8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUAVWU twCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x 0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_ Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIevJa73UjIFyTuYvjfUoO J5UUUUU 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_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 <newlib.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/newlib>, <mailto:newlib-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/newlib/> List-Post: <mailto:newlib@sourceware.org> List-Help: <mailto:newlib-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/newlib>, <mailto:newlib-request@sourceware.org?subject=subscribe> Errors-To: newlib-bounces+patchwork=sourceware.org@sourceware.org |
Series |
[PING^1] newlib: libc: Improved the readability of strspn with minor optimization
|
|
Commit Message
Xiao Zeng
Jan. 2, 2024, 5:56 a.m. UTC
Signed-off-by: Xiao Zeng <zengxiao@eswincomputing.com>
---
newlib/libc/string/strspn.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
Hello, I modified the code to change the label to "found" instead of "end" since "end" is usually used to jump to the end of function as opposed to loop. Modified code has been merged. -- Jeff J. On Tue, Jan 2, 2024 at 12:57 AM Xiao Zeng <zengxiao@eswincomputing.com> wrote: > 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 > >
2024-01-03 03:24 Jeff Johnston <jjohnstn@redhat.com> wrote: > >Hello, > >I modified the code to change the label to "found" instead of "end" since >"end" is usually used to jump to the end of function as opposed to loop. Thank you Jeff, your modifications have made the code more meaningful. >Modified code has been merged. > >-- Jeff J. > >On Tue, Jan 2, 2024 at 12:57 AM Xiao Zeng <zengxiao@eswincomputing.com> >wrote: > >> 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 >> >> Thanks Xiao Zeng
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++; }