From: Wang YanQing <udknight@gmail.com>
To: mmarek@suse.cz
Cc: linux-kbuild@vger.kernel.org, yann.morin.1998@free.fr,
bpoirier@suse.de, walch.martin@web.de, jdelvare@suse.de,
linux-kernel@vger.kernel.org
Subject: [PATCH]kconfig:mconf: avoid unneeded memcpy
Date: Sun, 6 Oct 2013 01:57:15 +0800 [thread overview]
Message-ID: <20131005175715.GA28091@udknight> (raw)
In function update_text we assign jump key label
per page (1)-(9) cycled, and use three space char
as the header after k exceed JUMP_NB.
We don't need to call memcpy with header of three
space char, because it changes nothing, it just
copy what was there.
I don't think we need to clear old jump key label in
current implementation, I can't image out any case
which a search result could change its jump key label,
unless user search new string, but then we will re-assign
jump key label, and it will be fix after that.
Signed-off-by: Wang YanQing <udknight@gmail.com>
---
scripts/kconfig/mconf.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 2c39631..ff9d737 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -379,11 +379,8 @@ static void update_text(char *buf, size_t start, size_t end, void *_data)
data->keys[k] = key;
data->targets[k] = pos->target;
k++;
- } else {
- sprintf(header, " ");
+ memcpy(buf + pos->offset, header, sizeof(header) - 1);
}
-
- memcpy(buf + pos->offset, header, sizeof(header) - 1);
}
}
data->keys[k] = 0;
--
1.7.12.4.dirty
next reply other threads:[~2013-10-05 17:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-05 17:57 Wang YanQing [this message]
2013-10-06 15:18 ` [PATCH]kconfig:mconf: avoid unneeded memcpy Wang YanQing
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=20131005175715.GA28091@udknight \
--to=udknight@gmail.com \
--cc=bpoirier@suse.de \
--cc=jdelvare@suse.de \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmarek@suse.cz \
--cc=walch.martin@web.de \
--cc=yann.morin.1998@free.fr \
/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