diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2014-09-22 21:17:24 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2014-09-22 21:17:24 +0200 |
commit | 865814a617cc2b197ef0ad12ee331a7a01d30e1a (patch) | |
tree | 8d30fdeeefc2e496b256d34a52353bb52813177d | |
parent | d6e7672545c717497490c0b0f54f64594f374f9d (diff) | |
download | busybox-w32-865814a617cc2b197ef0ad12ee331a7a01d30e1a.tar.gz busybox-w32-865814a617cc2b197ef0ad12ee331a7a01d30e1a.tar.bz2 busybox-w32-865814a617cc2b197ef0ad12ee331a7a01d30e1a.zip |
less: trivial code shrink
function old new delta
read_lines 715 695 -20
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | miscutils/less.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index 3016c5b47..c5820d325 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -428,14 +428,13 @@ static void read_lines(void) | |||
428 | w -= 8; | 428 | w -= 8; |
429 | 429 | ||
430 | p = current_line = ((char*)xmalloc(w + 4)) + 4; | 430 | p = current_line = ((char*)xmalloc(w + 4)) + 4; |
431 | max_fline += last_terminated; | ||
432 | if (!last_terminated) { | 431 | if (!last_terminated) { |
433 | const char *cp = flines[max_fline]; | 432 | const char *cp = flines[max_fline]; |
434 | strcpy(p, cp); | 433 | p = stpcpy(p, cp); |
435 | p += strlen(current_line); | 434 | free(MEMPTR(cp)); |
436 | free(MEMPTR(flines[max_fline])); | ||
437 | /* last_line_pos is still valid from previous read_lines() */ | 435 | /* last_line_pos is still valid from previous read_lines() */ |
438 | } else { | 436 | } else { |
437 | max_fline++; | ||
439 | last_line_pos = 0; | 438 | last_line_pos = 0; |
440 | } | 439 | } |
441 | 440 | ||