summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2014-09-22 21:17:24 +0200
committerDenys Vlasenko2014-09-22 21:17:24 +0200
commit865814a617cc2b197ef0ad12ee331a7a01d30e1a (patch)
tree8d30fdeeefc2e496b256d34a52353bb52813177d
parentd6e7672545c717497490c0b0f54f64594f374f9d (diff)
downloadbusybox-865814a617cc2b197ef0ad12ee331a7a01d30e1a.zip
busybox-865814a617cc2b197ef0ad12ee331a7a01d30e1a.tar.gz
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.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/miscutils/less.c b/miscutils/less.c
index 3016c5b..c5820d3 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -428,14 +428,13 @@ static void read_lines(void)
w -= 8;
p = current_line = ((char*)xmalloc(w + 4)) + 4;
- max_fline += last_terminated;
if (!last_terminated) {
const char *cp = flines[max_fline];
- strcpy(p, cp);
- p += strlen(current_line);
- free(MEMPTR(flines[max_fline]));
+ p = stpcpy(p, cp);
+ free(MEMPTR(cp));
/* last_line_pos is still valid from previous read_lines() */
} else {
+ max_fline++;
last_line_pos = 0;
}