From: Denys Vlasenko Date: Mon, 22 Sep 2014 19:17:24 +0000 (+0200) Subject: less: trivial code shrink X-Git-Tag: 1_23_0~43 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=865814a617cc2b197ef0ad12ee331a7a01d30e1a;p=oweals%2Fbusybox.git less: trivial code shrink function old new delta read_lines 715 695 -20 Signed-off-by: Denys Vlasenko --- 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) 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; }