diff options
| author | Pedro F. Giffuni <pfg@FreeBSD.org> | 2014-06-14 01:58:33 +0000 |
|---|---|---|
| committer | Pedro F. Giffuni <pfg@FreeBSD.org> | 2014-06-14 01:58:33 +0000 |
| commit | c44f94d0cde8b9cc3ce4947f4f732c1078e64669 (patch) | |
| tree | 922196cb7772b3588ddceee6581d4bdb327084ce /usr.bin/patch | |
| parent | 2289da421684bce31f2c64c6e0843864c8824a63 (diff) | |
Notes
Diffstat (limited to 'usr.bin/patch')
| -rw-r--r-- | usr.bin/patch/pch.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c index 2ca528adaee0..691add1efe26 100644 --- a/usr.bin/patch/pch.c +++ b/usr.bin/patch/pch.c @@ -132,11 +132,11 @@ void set_hunkmax(void) { if (p_line == NULL) - p_line = malloc((size_t) hunkmax * sizeof(char *)); + p_line = malloc(hunkmax * sizeof(char *)); if (p_len == NULL) - p_len = malloc((size_t) hunkmax * sizeof(short)); + p_len = malloc(hunkmax * sizeof(short)); if (p_char == NULL) - p_char = malloc((size_t) hunkmax * sizeof(char)); + p_char = malloc(hunkmax * sizeof(char)); } /* @@ -145,23 +145,14 @@ set_hunkmax(void) static void grow_hunkmax(void) { - int new_hunkmax; - char **new_p_line; - short *new_p_len; - char *new_p_char; - - new_hunkmax = hunkmax * 2; + int new_hunkmax = hunkmax * 2; if (p_line == NULL || p_len == NULL || p_char == NULL) fatal("Internal memory allocation error\n"); - new_p_line = reallocf(p_line, new_hunkmax * sizeof(char *)); - new_p_len = reallocf(p_len, new_hunkmax * sizeof(short)); - new_p_char = reallocf(p_char, new_hunkmax * sizeof(char)); - - p_char = new_p_char; - p_len = new_p_len; - p_line = new_p_line; + p_line = reallocf(p_line, new_hunkmax * sizeof(char *)); + p_len = reallocf(p_len, new_hunkmax * sizeof(short)); + p_char = reallocf(p_char, new_hunkmax * sizeof(char)); if (p_line != NULL && p_len != NULL && p_char != NULL) { hunkmax = new_hunkmax; |
