erofs-utils: lib: don't include <lzma.h> and <zlib.h> in external headers
PATCH 1/1 erofs-utils: lib: don't include <lzma.h> and <zlib.h> in external headers
Applications don't need internal header dependencies.
Signed-off-by Gao Xiang <[email protected]>
--- include/erofs/tar.h | 12 +----------- lib/tar.c | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 14 deletions(-)
include/erofs/tar.h +1 -11
@@ -7,9 +7,6 @@ extern "C" {#endif -#if defined(HAVE_ZLIB ) -#include <zlib.h> -#endif #include <sys/stat.h> #include "internal.h"
@@ -28,14 +25,7 @@ struct erofs_pax_header {#define EROFS_IOS_DECODER_GZIP 1#define EROFS_IOS_DECODER_LIBLZMA 2 -#ifdef HAVE_LIBLZMA -#include <lzma.h> -struct erofs_iostream_liblzma { -u8 inbuf[32768 ]; -lzma_stream strm; -int fd; -}; -#endif +struct erofs_iostream_liblzma ; struct erofs_iostream { union {
lib/tar.c +12 -3
@@ -3,9 +3,6 @@#include <stdlib.h> #include <string.h> #include <sys/stat.h> -#if defined(HAVE_ZLIB ) -#include <zlib.h> -#endif #include "erofs/print.h" #include "erofs/cache.h" #include "erofs/diskbuf.h"
@@ -15,6 +12,9 @@#include "erofs/xattr.h" #include "erofs/blobchunk.h" #include "erofs/rebuild.h" +#if defined(HAVE_ZLIB ) +#include <zlib.h> +#endif /* This file is a tape/volume header. Ignore it on extraction. */ #define GNUTYPE_VOLHDR 'V'
@@ -39,6 +39,15 @@ struct tar_header {char padding[12 ];/* 500-512 (pad to exactly the 512 byte) */ }; +#ifdef HAVE_LIBLZMA +#include <lzma.h> +struct erofs_iostream_liblzma { +u8 inbuf[32768 ]; +lzma_stream strm; +int fd; +}; +#endif +void erofs_iostream_close (struct erofs_iostream *ios) {free (ios->buffer);
Signature · 1 line
2.39.3 (Apple Git-146)
Reviewed-by Sandeep Dhavale <[email protected]>
Thanks,
Sandeep.