diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-07-23 05:28:15 -0400 |
---|---|---|
committer | Michael BRANDT <michael.brandt@stericsson.com> | 2010-10-21 14:26:07 +0200 |
commit | 421f415d97976de1ec3b2c2d71c1994a01f7b98d (patch) | |
tree | 280e8e9d32f5f88d3b65a35c25cf4895bba0426e /common/main.c | |
parent | d78dda3712f7151b241b5f5f3fe2c947d83c6f3e (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>
Change-Id: Ic1e4eb92b6d9c61efec585433152c907e449fe44
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/6818
Reviewed-by: Michael BRANDT <michael.brandt@stericsson.com>
Tested-by: Michael BRANDT <michael.brandt@stericsson.com>
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 e838770da..9c011e260 100644 --- a/common/main.c +++ b/common/main.c @@ -653,12 +653,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); \ } \ } |