jit: Fix Darwin bootstrap after r15-1699.
[official-gcc.git] / gcc / testsuite / c-c++-common / analyzer / zlib-2.c
blob62163a037acb5dece0dec09aba2ae686429c78f5
1 typedef void * (*alloc_func)(void * opaque, unsigned items, unsigned size);
2 typedef void (*free_func)(void * opaque, void * address);
4 typedef struct z_stream_s {
5 char *msg;
6 alloc_func zalloc;
7 free_func zfree;
8 void * opaque;
9 } z_stream;
11 void * zcalloc(void * opaque, unsigned items, unsigned size);
12 void zcfree(void * opaque, void * ptr);
14 int deflateInit2_(z_stream *strm, int level, int method, int windowBits,
15 int memLevel, int strategy, const char *version,
16 int stream_size) {
17 int noheader = 0;
18 static const char *my_version = "1.1.3";
20 if (version == 0 || version[0] != my_version[0] ||
21 stream_size != sizeof(z_stream)) {
22 return (-6);
24 if (strm == 0)
25 return (-2);
27 strm->msg = 0;
28 if (strm->zalloc == 0) {
29 strm->zalloc = zcalloc;
30 strm->opaque = (void *)0;
32 if (strm->zfree == 0)
33 strm->zfree = zcfree;
35 if (level == (-1))
36 level = 6;
38 if (windowBits < 0) {
39 noheader = 1;
40 windowBits = -windowBits;
42 if (memLevel < 1 || memLevel > 9 || method != 8 || windowBits < 8 ||
43 windowBits > 15 || level < 0 || level > 9 || strategy < 0 ||
44 strategy > 2) {
45 return (-2);
47 (*((strm)->zalloc))((strm)->opaque, (1), 112);
48 return 0;