diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2015-07-28 21:55:09 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2015-07-28 21:55:09 -0700 |
commit | 0b22337126401ef68ac5cf0308413239a4fb9c83 (patch) | |
tree | ecd77f3b5a929bc1b611938c828bdeb83d7981f3 /test | |
parent | 0db8fd371477f42c280ddeee29e6de092fabf948 (diff) | |
download | zlib-0b22337126401ef68ac5cf0308413239a4fb9c83.tar.gz zlib-0b22337126401ef68ac5cf0308413239a4fb9c83.tar.bz2 zlib-0b22337126401ef68ac5cf0308413239a4fb9c83.zip |
Avoid use of reallocf() in test/infcover.c.
Diffstat (limited to 'test')
-rw-r--r-- | test/infcover.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/test/infcover.c b/test/infcover.c index fe3d920..3153234 100644 --- a/test/infcover.c +++ b/test/infcover.c | |||
@@ -237,14 +237,14 @@ local void mem_done(z_stream *strm, char *prefix) | |||
237 | 237 | ||
238 | /* Decode a hexadecimal string, set *len to length, in[] to the bytes. This | 238 | /* Decode a hexadecimal string, set *len to length, in[] to the bytes. This |
239 | decodes liberally, in that hex digits can be adjacent, in which case two in | 239 | decodes liberally, in that hex digits can be adjacent, in which case two in |
240 | a row writes a byte. Or they can delimited by any non-hex character, where | 240 | a row writes a byte. Or they can be delimited by any non-hex character, |
241 | the delimiters are ignored except when a single hex digit is followed by a | 241 | where the delimiters are ignored except when a single hex digit is followed |
242 | delimiter in which case that single digit writes a byte. The returned | 242 | by a delimiter, where that single digit writes a byte. The returned data is |
243 | data is allocated and must eventually be freed. NULL is returned if out of | 243 | allocated and must eventually be freed. NULL is returned if out of memory. |
244 | memory. If the length is not needed, then len can be NULL. */ | 244 | If the length is not needed, then len can be NULL. */ |
245 | local unsigned char *h2b(const char *hex, unsigned *len) | 245 | local unsigned char *h2b(const char *hex, unsigned *len) |
246 | { | 246 | { |
247 | unsigned char *in; | 247 | unsigned char *in, *re; |
248 | unsigned next, val; | 248 | unsigned next, val; |
249 | 249 | ||
250 | in = malloc((strlen(hex) + 1) >> 1); | 250 | in = malloc((strlen(hex) + 1) >> 1); |
@@ -268,8 +268,8 @@ local unsigned char *h2b(const char *hex, unsigned *len) | |||
268 | } while (*hex++); /* go through the loop with the terminating null */ | 268 | } while (*hex++); /* go through the loop with the terminating null */ |
269 | if (len != NULL) | 269 | if (len != NULL) |
270 | *len = next; | 270 | *len = next; |
271 | in = reallocf(in, next); | 271 | re = realloc(in, next); |
272 | return in; | 272 | return re == NULL ? in : re; |
273 | } | 273 | } |
274 | 274 | ||
275 | /* generic inflate() run, where hex is the hexadecimal input data, what is the | 275 | /* generic inflate() run, where hex is the hexadecimal input data, what is the |