X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/9bccf70c0258c7cac2dcb80011b2a964d884c552..39236c6e673c41db228275375ab7fdb0f837b292:/bsd/netinet6/ipcomp_core.c diff --git a/bsd/netinet6/ipcomp_core.c b/bsd/netinet6/ipcomp_core.c index 1ca103860..55dcbf506 100644 --- a/bsd/netinet6/ipcomp_core.c +++ b/bsd/netinet6/ipcomp_core.c @@ -50,8 +50,9 @@ #include #include -#include -#include +#if ZLIB +#include +#endif #include #include @@ -65,11 +66,12 @@ #include -static void *deflate_alloc __P((void *, u_int, u_int)); -static void deflate_free __P((void *, void *)); -static int deflate_common __P((struct mbuf *, struct mbuf *, size_t *, int)); -static int deflate_compress __P((struct mbuf *, struct mbuf *, size_t *)); -static int deflate_decompress __P((struct mbuf *, struct mbuf *, size_t *)); +#if ZLIB +static void *deflate_alloc(void *, u_int, u_int); +static void deflate_free(void *, void *); +static int deflate_common(struct mbuf *, struct mbuf *, size_t *, int); +static int deflate_compress(struct mbuf *, struct mbuf *, size_t *); +static int deflate_decompress(struct mbuf *, struct mbuf *, size_t *); /* * We need to use default window size (2^15 = 32Kbytes as of writing) for @@ -84,16 +86,24 @@ static int deflate_memlevel = MAX_MEM_LEVEL; static z_stream deflate_stream; static z_stream inflate_stream; +#endif /* ZLIB */ static const struct ipcomp_algorithm ipcomp_algorithms[] = { +#if ZLIB { deflate_compress, deflate_decompress, 90 }, +#endif /* ZLIB */ }; const struct ipcomp_algorithm * -ipcomp_algorithm_lookup(idx) - int idx; +ipcomp_algorithm_lookup( +#if ZLIB + int idx +#else + __unused int idx +#endif + ) { - +#if ZLIB if (idx == SADB_X_CALG_DEFLATE) { /* * Avert your gaze, ugly hack follows! @@ -130,24 +140,26 @@ ipcomp_algorithm_lookup(idx) return &ipcomp_algorithms[0]; } +#endif /* ZLIB */ return NULL; } +#if ZLIB static void * -deflate_alloc(aux, items, siz) - void *aux; - u_int items; - u_int siz; +deflate_alloc( + __unused void *aux, + u_int items, + u_int siz) { void *ptr; - ptr = _MALLOC(items * siz, M_TEMP, M_WAIT); + ptr = _MALLOC(items * siz, M_TEMP, M_NOWAIT); return ptr; } static void -deflate_free(aux, ptr) - void *aux; - void *ptr; +deflate_free( + __unused void *aux, + void *ptr) { FREE(ptr, M_TEMP); } @@ -260,8 +272,8 @@ do { \ /* inflate: Z_OK can indicate the end of decode */ if (mode && !p && zs->avail_out != 0) goto terminate; - else - ; /*once more.*/ + + /* else once more.*/ } else { if (zs->msg) { ipseclog((LOG_ERR, "ipcomp_%scompress: " @@ -398,3 +410,4 @@ deflate_decompress(m, md, lenp) return deflate_common(m, md, lenp, 1); } +#endif /* ZLIB */