| 1 |
|
| 2 |
|
| 3 |
#include "zbuild.h" |
| 4 |
#include "dfltcc_common.h" |
| 5 |
#include "dfltcc_detail.h" |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
static const int PAGE_ALIGN = 0x1000; |
| 17 |
|
| 18 |
void Z_INTERNAL *PREFIX(dfltcc_alloc_window)(PREFIX3(streamp) strm, uInt items, uInt size) { |
| 19 |
void *p; |
| 20 |
void *w; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
p = ZALLOC(strm, sizeof(void *) + items * size + PAGE_ALIGN, sizeof(unsigned char)); |
| 26 |
if (p == NULL) |
| 27 |
return NULL; |
| 28 |
w = ALIGN_UP((char *)p + sizeof(void *), PAGE_ALIGN); |
| 29 |
*(void **)((char *)w - sizeof(void *)) = p; |
| 30 |
return w; |
| 31 |
} |
| 32 |
|
| 33 |
void Z_INTERNAL PREFIX(dfltcc_free_window)(PREFIX3(streamp) strm, void *w) { |
| 34 |
if (w) |
| 35 |
ZFREE(strm, *(void **)((unsigned char *)w - sizeof(void *))); |
| 36 |
} |