1
2
3
4
5
6
7
8#include "zutil.h"
9
10#ifndef NO_DUMMY_DECL
11struct internal_state {int dummy;};
12#endif
13
14const char * const z_errmsg[10] = {
15"need dictionary",
16"stream end",
17"",
18"file error",
19"stream error",
20"data error",
21"insufficient memory",
22"buffer error",
23"incompatible version",
24""};
25
26#ifdef DEBUG
27
28#ifndef verbose
29#define verbose 0
30#endif
31int z_verbose = verbose;
32
33void z_error (m)
34 char *m;
35{
36 fprintf(stderr, "%s\n", m);
37 hang ();
38}
39#endif
40
41
42
43
44#ifndef MY_ZCALLOC
45
46#ifdef __UBOOT__
47#include <malloc.h>
48#else
49#ifndef STDC
50extern voidp malloc OF((uInt size));
51extern voidp calloc OF((uInt items, uInt size));
52extern void free OF((voidpf ptr));
53#endif
54#endif
55
56voidpf zcalloc(voidpf opaque, unsigned items, unsigned size)
57{
58 if (opaque)
59 items += size - size;
60 return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
61 (voidpf)calloc(items, size);
62}
63
64void zcfree(voidpf opaque, voidpf ptr, unsigned nb)
65{
66 free(ptr);
67 if (opaque)
68 return;
69}
70
71#endif
72