10ed1d6fbSXin LI /*
20ed1d6fbSXin LI * This file is in the public domain.
30ed1d6fbSXin LI */
40ed1d6fbSXin LI
50ed1d6fbSXin LI #include <sys/param.h>
60ed1d6fbSXin LI #include <dev/zlib/zcalloc.h>
70ed1d6fbSXin LI #include <sys/kernel.h>
80ed1d6fbSXin LI #include <sys/malloc.h>
90ed1d6fbSXin LI
100ed1d6fbSXin LI MALLOC_DEFINE(M_ZLIB, "zlib", "ZLIB Compressor");
110ed1d6fbSXin LI
120ed1d6fbSXin LI void *
zcalloc_waitok(void * nil,u_int items,u_int size)130ed1d6fbSXin LI zcalloc_waitok(void *nil, u_int items, u_int size)
140ed1d6fbSXin LI {
150ed1d6fbSXin LI
160ed1d6fbSXin LI return mallocarray(items, size, M_ZLIB, M_WAITOK);
170ed1d6fbSXin LI }
180ed1d6fbSXin LI
190ed1d6fbSXin LI void *
zcalloc_nowait(void * nil,u_int items,u_int size)200ed1d6fbSXin LI zcalloc_nowait(void *nil, u_int items, u_int size)
210ed1d6fbSXin LI {
220ed1d6fbSXin LI
230ed1d6fbSXin LI return mallocarray(items, size, M_ZLIB, M_NOWAIT);
240ed1d6fbSXin LI }
250ed1d6fbSXin LI
26*a15cb219SXin LI void *
zcalloc(void * nil,u_int items,u_int size)27*a15cb219SXin LI zcalloc(void *nil, u_int items, u_int size)
28*a15cb219SXin LI {
29*a15cb219SXin LI
30*a15cb219SXin LI return zcalloc_nowait(nil, items, size);
31*a15cb219SXin LI }
32*a15cb219SXin LI
330ed1d6fbSXin LI void
zcfree(void * nil,void * ptr)340ed1d6fbSXin LI zcfree(void *nil, void *ptr)
350ed1d6fbSXin LI {
360ed1d6fbSXin LI
370ed1d6fbSXin LI free(ptr, M_ZLIB);
380ed1d6fbSXin LI }
39