diff options
author | Matt Kraai | 2001-11-12 16:58:07 +0000 |
---|---|---|
committer | Matt Kraai | 2001-11-12 16:58:07 +0000 |
commit | a21c24bf03e4b8921a8afbf895de04273773dfac (patch) | |
tree | 4ea36d7601808197ee6cb238ed0edd63e1da079e /findutils | |
parent | c8227639db90c3147ef68f33c98e96b0ab6b01d6 (diff) | |
download | busybox-a21c24bf03e4b8921a8afbf895de04273773dfac.zip busybox-a21c24bf03e4b8921a8afbf895de04273773dfac.tar.gz |
Convert strdup call to xstrdup, and calloc calls to xcalloc (patch from
Steve Merrifield).
Diffstat (limited to 'findutils')
-rw-r--r-- | findutils/grep.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index faecb58..48329e1 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -155,7 +155,7 @@ static void grep_file(FILE *file) if(lines_before) { if(before_buf[curpos]) free(before_buf[curpos]); - before_buf[curpos] = strdup(line); + before_buf[curpos] = xstrdup(line); curpos = (curpos + 1) % lines_before; } } @@ -306,13 +306,13 @@ extern int grep_main(int argc, char **argv) lines_before = strtoul(optarg, &junk, 10); if(*junk != '\0') error_msg_and_die("invalid context length argument"); - before_buf = (char **)calloc(lines_before, sizeof(char *)); + before_buf = (char **)xcalloc(lines_before, sizeof(char *)); break; case 'C': lines_after = lines_before = strtoul(optarg, &junk, 10); if(*junk != '\0') error_msg_and_die("invalid context length argument"); - before_buf = (char **)calloc(lines_before, sizeof(char *)); + before_buf = (char **)xcalloc(lines_before, sizeof(char *)); break; #endif /* CONFIG_FEATURE_GREP_CONTEXT */ default: |