ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/vendor/libz/dist/test/infcover.c
(Generate patch)

Comparing vendor/libz/dist/test/infcover.c (file contents):
Revision 9709 by laffer1, Sat Apr 12 00:14:49 2014 UTC vs.
Revision 9710 by laffer1, Mon Dec 18 20:51:41 2017 UTC

# Line 1 | Line 1
1   /* infcover.c -- test zlib's inflate routines with full code coverage
2 < * Copyright (C) 2011 Mark Adler
2 > * Copyright (C) 2011, 2016 Mark Adler
3   * For conditions of distribution and use, see copyright notice in zlib.h
4   */
5  
# Line 237 | Line 237 | local void mem_done(z_stream *strm, char *prefix)
237  
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
240 <   a row writes a byte.  Or they can delimited by any non-hex character, where
241 <   the delimiters are ignored except when a single hex digit is followed by a
242 <   delimiter in which case that single digit writes a byte.  The returned
243 <   data is allocated and must eventually be freed.  NULL is returned if out of
244 <   memory.  If the length is not needed, then len can be NULL. */
240 >   a row writes a byte.  Or they can be delimited by any non-hex character,
241 >   where the delimiters are ignored except when a single hex digit is followed
242 >   by a delimiter, where that single digit writes a byte.  The returned data is
243 >   allocated and must eventually be freed.  NULL is returned if out of memory.
244 >   If the length is not needed, then len can be NULL. */
245   local unsigned char *h2b(const char *hex, unsigned *len)
246   {
247 <    unsigned char *in;
247 >    unsigned char *in, *re;
248      unsigned next, val;
249  
250      in = malloc((strlen(hex) + 1) >> 1);
# Line 268 | Line 268 | local unsigned char *h2b(const char *hex, unsigned *le
268      } while (*hex++);       /* go through the loop with the terminating null */
269      if (len != NULL)
270          *len = next;
271 <    in = reallocf(in, next);
272 <    return in;
271 >    re = realloc(in, next);
272 >    return re == NULL ? in : re;
273   }
274  
275   /* generic inflate() run, where hex is the hexadecimal input data, what is the

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines