mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Anshul Garg <aksgarg1989@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: aksgarg1989@gmail.com, anshul.g@samsung.com,
	torvalds@linux-foundation.org
Subject: [PATCH] lib/vsprintf.c:Avoid extra operation in dentry_name
Date: Mon, 16 Feb 2015 10:49:43 -0800	[thread overview]
Message-ID: <1424112583-116849-1-git-send-email-aksgarg1989@gmail.com> (raw)
In-Reply-To: <aksgarg1989@gmail.com>

From: Anshul Garg <aksgarg1989@gmail.com>

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 <aksgarg1989@gmail.com>
---
 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) {
-- 
1.7.9.5


---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com


             reply	other threads:[~2015-02-16 18:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-16 18:49 Anshul Garg [this message]
2015-02-16 19:14 ` Richard Weinberger
2015-02-17 17:11   ` Anshul Garg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1424112583-116849-1-git-send-email-aksgarg1989@gmail.com \
    --to=aksgarg1989@gmail.com \
    --cc=anshul.g@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®