Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753863AbbBPTOJ (ORCPT ); Mon, 16 Feb 2015 14:14:09 -0500 Received: from mail-vc0-f179.google.com ([209.85.220.179]:62692 "EHLO mail-vc0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753237AbbBPTOH (ORCPT ); Mon, 16 Feb 2015 14:14:07 -0500 MIME-Version: 1.0 In-Reply-To: <1424112583-116849-1-git-send-email-aksgarg1989@gmail.com> References: <1424112583-116849-1-git-send-email-aksgarg1989@gmail.com> Date: Mon, 16 Feb 2015 20:14:05 +0100 Message-ID: Subject: Re: [PATCH] lib/vsprintf.c:Avoid extra operation in dentry_name From: Richard Weinberger To: Anshul Garg Cc: LKML , anshul.g@samsung.com, Linus Torvalds Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1476 Lines: 43 On Mon, Feb 16, 2015 at 7:49 PM, Anshul Garg wrote: > From: Anshul Garg > > Remove unnecessary increment and decrement operation > in dentry_name function as after increment operation > loop is breaked and then decrement operation is > performed. So remove increment and decrement operation > from the function. > > Signed-off-by: Anshul Garg > --- > lib/vsprintf.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/lib/vsprintf.c b/lib/vsprintf.c > index ec337f6..2a38105 100644 > --- a/lib/vsprintf.c > +++ b/lib/vsprintf.c > @@ -576,11 +576,10 @@ char *dentry_name(char *buf, char *end, const struct dentry *d, struct printf_sp > if (p == d) { > if (i) > array[i] = ""; > - i++; > break; > } > } > - s = array[--i]; > + s = array[i]; > for (n = 0; n != spec.precision; n++, buf++) { > char c = *s++; > if (!c) { What if the if (d == d) branch is not taken? Does the code then really behave exactly as before? -- Thanks, //richard -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/