diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-07-23 05:28:15 -0400 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2010-08-09 00:26:04 +0200 |
commit | 8faba4894c6e2bafbfab17260f3db17867cd50d2 (patch) | |
tree | ff0250e8434708d53d2d58fbd0363962f12da028 /common/main.c | |
parent | 8011ec638e16695081ce65ce3997499ba41c8ba3 (diff) |
cmd editing: optimize/shrink output blanking
No need to output spaces 1 char at a time in a loop when the printf code
can do the same thing with the right format string. This shrinks things
and gives a nice speed up when killing off lines more than a byte or two
as printf will send out the buffer in one big chunk.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'common/main.c')
-rw-r--r-- | common/main.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/common/main.c b/common/main.c index 54ef79e2649..8d548dbc85d 100644 --- a/common/main.c +++ b/common/main.c @@ -643,12 +643,10 @@ static void cread_print_hist_list(void) #define ERASE_TO_EOL() { \ if (num < eol_num) { \ - int tmp; \ - for (tmp = num; tmp < eol_num; tmp++) \ - getcmd_putch(' '); \ - while (tmp-- > num) \ + printf("%*s", (int)(eol_num - num), ""); \ + do { \ getcmd_putch(CTL_BACKSPACE); \ - eol_num = num; \ + } while (--eol_num > num); \ } \ } |