mirror of
https://github.com/apple/swift-nio-extras
synced 2026-11-26 04:57:49 +00:00
### Motivation: Relying on the system zlib causes issues if that library (or its headers) doesn't ship with the system. ### Modifications: Vendor it. ### Result: - Fewer dependencies. - Binary size increase negligible. The _sum of the debug builds_ of all `.o` files is less than 200kB. A linked release build will make this even smaller: ``` $ du -k .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/*.o 12 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/adler32.c.o 12 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/crc32.c.o 60 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/deflate.c.o 16 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/inffast.c.o 40 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/inflate.c.o 16 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/inftrees.c.o 40 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/trees.c.o 8 .build/arm64-apple-macosx/debug/CNIOExtrasZlib.build/zutil.c.o ``` Co-authored-by: Johannes Weiss <johannes@jweiss.io>
37 lines
1.3 KiB
C
37 lines
1.3 KiB
C
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2017-2026 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
#ifndef C_NIO_ZLIB_H
|
|
#define C_NIO_ZLIB_H
|
|
|
|
#include "nioextras-zlib.h"
|
|
|
|
static inline int CNIOExtrasZlib_deflateInit2(cnioextras_z_streamp strm,
|
|
int level,
|
|
int method,
|
|
int windowBits,
|
|
int memLevel,
|
|
int strategy) {
|
|
return cnioextras_z_deflateInit2(strm, level, method, windowBits, memLevel, strategy);
|
|
}
|
|
|
|
static inline int CNIOExtrasZlib_inflateInit2(cnioextras_z_streamp strm, int windowBits) {
|
|
return cnioextras_z_inflateInit2(strm, windowBits);
|
|
}
|
|
|
|
static inline cnioextras_z_Bytef *CNIOExtrasZlib_voidPtr_to_BytefPtr(void *in) {
|
|
return (cnioextras_z_Bytef *)in;
|
|
}
|
|
|
|
#endif
|