diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-04-16 21:30:47 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-04-16 21:30:47 +0000 |
commit | bf2d9905caaf878efc6ee2b42069136634b2d92a (patch) | |
tree | bf28d36028fc65a7e351050314a2053ce88284c7 /miscutils/less.c | |
parent | f8346038e9899bf7d113d36f89497d854224e2a6 (diff) | |
download | busybox-w32-bf2d9905caaf878efc6ee2b42069136634b2d92a.tar.gz busybox-w32-bf2d9905caaf878efc6ee2b42069136634b2d92a.tar.bz2 busybox-w32-bf2d9905caaf878efc6ee2b42069136634b2d92a.zip |
use xmalloc, dont hardcode length of string, and get rid of pointless call to memset
Diffstat (limited to 'miscutils/less.c')
-rw-r--r-- | miscutils/less.c | 5 |
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) | |||
625 | insert_highlights, and then the line is returned. */ | 625 | insert_highlights, and then the line is returned. */ |
626 | 626 | ||
627 | int match_status; | 627 | int match_status; |
628 | char *line2 = (char *) malloc((sizeof(char) * (strlen(line) + 1)) + 64); | 628 | char *line2 = (char *) xmalloc((sizeof(char) * (strlen(line) + 1)) + 64); |
629 | char sub_line[256]; | 629 | char sub_line[256]; |
630 | int prev_eo = 0; | 630 | int prev_eo = 0; |
631 | regmatch_t match_structs; | 631 | regmatch_t match_structs; |
632 | 632 | ||
633 | memset(sub_line, 0, 256); | ||
634 | strcpy(line2, line); | 633 | strcpy(line2, line); |
635 | 634 | ||
636 | match_found = 0; | 635 | match_found = 0; |
@@ -638,7 +637,7 @@ static char *process_regex_on_line(char *line, regex_t *pattern) | |||
638 | 637 | ||
639 | while (match_status == 0) { | 638 | while (match_status == 0) { |
640 | 639 | ||
641 | memset(sub_line, 0, 256); | 640 | memset(sub_line, 0, sizeof(sub_line)); |
642 | 641 | ||
643 | if (match_found == 0) | 642 | if (match_found == 0) |
644 | match_found = 1; | 643 | match_found = 1; |