mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
gunzip: rename z{alloc, free} to gz{alloc, free}
This allows us to add a proper zalloc() func (one that does a zeroing alloc), and removes duplicate prototypes. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
9a800ac718
commit
e3ed0575a7
3 changed files with 9 additions and 12 deletions
|
@ -27,9 +27,6 @@
|
||||||
|
|
||||||
static z_stream stream;
|
static z_stream stream;
|
||||||
|
|
||||||
void *zalloc(void *, unsigned, unsigned);
|
|
||||||
void zfree(void *, void *, unsigned);
|
|
||||||
|
|
||||||
/* Returns length of decompressed data. */
|
/* Returns length of decompressed data. */
|
||||||
int cramfs_uncompress_block (void *dst, void *src, int srclen)
|
int cramfs_uncompress_block (void *dst, void *src, int srclen)
|
||||||
{
|
{
|
||||||
|
@ -59,8 +56,8 @@ int cramfs_uncompress_init (void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
stream.zalloc = zalloc;
|
stream.zalloc = gzalloc;
|
||||||
stream.zfree = zfree;
|
stream.zfree = gzfree;
|
||||||
stream.next_in = 0;
|
stream.next_in = 0;
|
||||||
stream.avail_in = 0;
|
stream.avail_in = 0;
|
||||||
|
|
||||||
|
|
|
@ -691,6 +691,9 @@ ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits,
|
||||||
struct internal_state {int dummy;}; /* hack for buggy compilers */
|
struct internal_state {int dummy;}; /* hack for buggy compilers */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
extern void *gzalloc(void *, unsigned, unsigned);
|
||||||
|
extern void gzfree(void *, void *, unsigned);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
11
lib/gunzip.c
11
lib/gunzip.c
|
@ -36,10 +36,7 @@
|
||||||
#define RESERVED 0xe0
|
#define RESERVED 0xe0
|
||||||
#define DEFLATED 8
|
#define DEFLATED 8
|
||||||
|
|
||||||
void *zalloc(void *, unsigned, unsigned);
|
void *gzalloc(void *x, unsigned items, unsigned size)
|
||||||
void zfree(void *, void *, unsigned);
|
|
||||||
|
|
||||||
void *zalloc(void *x, unsigned items, unsigned size)
|
|
||||||
{
|
{
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
|
@ -51,7 +48,7 @@ void *zalloc(void *x, unsigned items, unsigned size)
|
||||||
return (p);
|
return (p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zfree(void *x, void *addr, unsigned nb)
|
void gzfree(void *x, void *addr, unsigned nb)
|
||||||
{
|
{
|
||||||
free (addr);
|
free (addr);
|
||||||
}
|
}
|
||||||
|
@ -94,8 +91,8 @@ int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
|
||||||
z_stream s;
|
z_stream s;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
s.zalloc = zalloc;
|
s.zalloc = gzalloc;
|
||||||
s.zfree = zfree;
|
s.zfree = gzfree;
|
||||||
|
|
||||||
r = inflateInit2(&s, -MAX_WBITS);
|
r = inflateInit2(&s, -MAX_WBITS);
|
||||||
if (r != Z_OK) {
|
if (r != Z_OK) {
|
||||||
|
|
Loading…
Reference in a new issue