* [PATCH]kconfig:mconf: avoid unneeded memcpy
@ 2013-10-05 17:57 Wang YanQing
2013-10-06 15:18 ` Wang YanQing
0 siblings, 1 reply; 2+ messages in thread
From: Wang YanQing @ 2013-10-05 17:57 UTC (permalink / raw)
To: mmarek
Cc: linux-kbuild, yann.morin.1998, bpoirier, walch.martin, jdelvare,
linux-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH]kconfig:mconf: avoid unneeded memcpy
2013-10-05 17:57 [PATCH]kconfig:mconf: avoid unneeded memcpy Wang YanQing
@ 2013-10-06 15:18 ` Wang YanQing
0 siblings, 0 replies; 2+ messages in thread
From: Wang YanQing @ 2013-10-06 15:18 UTC (permalink / raw)
To: mmarek, linux-kbuild, yann.morin.1998, bpoirier, walch.martin,
jdelvare, linux-kernel
On Sun, Oct 06, 2013 at 01:57:15AM +0800, Wang YanQing wrote:
> 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
Hi all, please ignore this patch.
I image out that we need to clear old jump label when we run
make menuconfig in a x11 terminal with high resolution that
could show more than 9 item in one page.
Sorry.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-10-06 15:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-05 17:57 [PATCH]kconfig:mconf: avoid unneeded memcpy Wang YanQing
2013-10-06 15:18 ` Wang YanQing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox