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#ifndef STDC
47extern voidp malloc OF((uInt size));
48extern voidp calloc OF((uInt items, uInt size));
49extern void free OF((voidpf ptr));
50#endif
51
52voidpf zcalloc(voidpf opaque, unsigned items, unsigned size)
53{
54 if (opaque)
55 items += size - size;
56 return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) :
57 (voidpf)calloc(items, size);
58}
59
60void zcfree(voidpf opaque, voidpf ptr, unsigned nb)
61{
62 free(ptr);
63 if (opaque)
64 return;
65}
66
67#endif
68