aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorGravatar Mike Frysinger <vapier@gentoo.org>2006-04-16 21:30:47 +0000
committerGravatar Mike Frysinger <vapier@gentoo.org>2006-04-16 21:30:47 +0000
commitbf2d9905caaf878efc6ee2b42069136634b2d92a (patch)
treebf28d36028fc65a7e351050314a2053ce88284c7 /miscutils
parentf8346038e9899bf7d113d36f89497d854224e2a6 (diff)
downloadbusybox-bf2d9905caaf878efc6ee2b42069136634b2d92a.tar.gz
busybox-bf2d9905caaf878efc6ee2b42069136634b2d92a.tar.bz2
use xmalloc, dont hardcode length of string, and get rid of pointless call to memset
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/less.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/miscutils/less.c b/miscutils/less.c
index 6b0cab526..eba916a80 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -625,12 +625,11 @@ static char *process_regex_on_line(char *line, regex_t *pattern)
insert_highlights, and then the line is returned. */
int match_status;
- char *line2 = (char *) malloc((sizeof(char) * (strlen(line) + 1)) + 64);
+ char *line2 = (char *) xmalloc((sizeof(char) * (strlen(line) + 1)) + 64);
char sub_line[256];
int prev_eo = 0;
regmatch_t match_structs;
- memset(sub_line, 0, 256);
strcpy(line2, line);
match_found = 0;
@@ -638,7 +637,7 @@ static char *process_regex_on_line(char *line, regex_t *pattern)
while (match_status == 0) {
- memset(sub_line, 0, 256);
+ memset(sub_line, 0, sizeof(sub_line));
if (match_found == 0)
match_found = 1;