From patchwork Wed Dec 18 18:56:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Cooper X-Patchwork-Id: 3371371 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 757E39F314 for ; Wed, 18 Dec 2013 18:57:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E10B205F0 for ; Wed, 18 Dec 2013 18:57:09 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8C371205ED for ; Wed, 18 Dec 2013 18:57:04 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VtMIh-0002y8-6m; Wed, 18 Dec 2013 18:56:55 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VtMIe-00084j-PR; Wed, 18 Dec 2013 18:56:52 +0000 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VtMIb-000841-Cb for linux-arm-kernel@lists.infradead.org; Wed, 18 Dec 2013 18:56:50 +0000 Received: from pool-108-39-110-144.nrflva.fios.verizon.net ([108.39.110.144] helo=titan) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1VtMIG-000Ddn-3v; Wed, 18 Dec 2013 18:56:28 +0000 Received: from titan.lakedaemon.net (localhost [127.0.0.1]) by titan (Postfix) with ESMTP id 6EB804F60CA; Wed, 18 Dec 2013 13:56:24 -0500 (EST) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 108.39.110.144 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX19pFbU+ofL6L6gPDqEVeD2tT/22s9XHO4o= X-DKIM: OpenDKIM Filter v2.0.1 titan 6EB804F60CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lakedaemon.net; s=mail; t=1387392984; bh=kL2lkgSG0UHNMMiRe0qKKjEgirr83GmKHfA1Cryz998=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=ueJ4ZokgBtu+pjTxEFvflo+vatSjFy6g/Vw3MtRBJFZd8PizBsI1VDubGQqW2UL2g Mg4+gauXhc91Td1q+m9XfDXQS7Su0KG2zNkV901ICRVJ6hv0Ibp9EwzyiEA2QtqyGw qNo+KE2l80UslpnpJe2mLrPfNpxdwPln5JN2uSXYgWWhhtI9zTuR/jMFVXq8RCNmBk /rhU3Rkp5UidyrUKTM8JbbWbX/E7UafngqY9D6AsoGEhu48MYg7CV01pEJK3IqD06Z Rpf5brYgjRwtn6rx1E9gPzOnV4sHMF5gbq5UhTsqH/y8H60W5GS0MwRvFKiVFGwpl+ R0o5cWE75BL1g== Date: Wed, 18 Dec 2013 13:56:24 -0500 From: Jason Cooper To: Russell King - ARM Linux Subject: Re: [PATCH V2 2/8] string: fix strncmp function Message-ID: <20131218185624.GS2609@titan.lakedaemon.net> References: <1386767259-15693-1-git-send-email-p.wilczek@samsung.com> <1387368551-18958-1-git-send-email-p.wilczek@samsung.com> <1387368551-18958-3-git-send-email-p.wilczek@samsung.com> <20131218121551.GH4360@n2100.arm.linux.org.uk> <52B193BE.1080206@gmail.com> <20131218125203.GI4360@n2100.arm.linux.org.uk> <20131218160114.GP2609@titan.lakedaemon.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20131218160114.GP2609@titan.lakedaemon.net> User-Agent: Mutt/1.5.20 (2009-06-14) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131218_135649_448062_AF3416AA X-CRM114-Status: GOOD ( 18.63 ) X-Spam-Score: -2.0 (--) Cc: Nicolas Pitre , Piotr Wilczek , devicetree-discuss@lists.ozlabs.org, Daniel Mack , Kyungmin Park , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Dec 18, 2013 at 11:01:15AM -0500, Jason Cooper wrote: > On Wed, Dec 18, 2013 at 12:52:03PM +0000, Russell King - ARM Linux wrote: > > Oh, and the other nitpick with the code is this: > > > > *(a++) > > > > Really, are those parens really needed? If you don't know the precendence > > there, then you really shouldn't be programming in C, because this might > > also be buggy: > > > > *(a++) - *(b++) > > > > because if we declare that we don't know the precedence rules, it could be > > that this is evaluated as *((a++) - (*(b++))) which would lead to errors! > > Maybe some more parens should be added to make it clear! Or maybe we > > should just learn the precedence rules and realise that: > > > > *a++ - *b++ > > > > is correct and clear and there's no need for any stupid idiotic parens > > here. > > > > Yes, I loath unnecessary parens. and I've also pushed the following: ---------------8<---------------------------- commit 6a5d02f396107b2a0f4337d11e63c12ecd2a49c1 Author: Jason Cooper Date: Wed Dec 18 18:19:38 2013 +0000 string: remove unneeded parentheses Signed-off-by: Jason Cooper diff --git a/string.c b/string.c index 0bd71798c4e6..5105490143c8 100644 --- a/string.c +++ b/string.c @@ -10,7 +10,7 @@ int strlen(const char *str) { const char *c = str; - while (*(c++)) + while (*c++) ; return c - str; @@ -23,7 +23,7 @@ int strncmp(const char *stra, const char *strb, int len) const char *b = strb; while ((a - stra) < len) - diff += *(a++) - *(b++); + diff += *a++ - *b++; return diff; }