From 27653adc8b7ebe44bd357511de53d0c14eef0894 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 6 May 2010 14:19:19 +0000 Subject: rpm: code shrink. Now uses open_zipped's logic (factored out into setup_unzip_on_fd()) function old new delta setup_unzip_on_fd - 80 +80 open_zipped 176 113 -63 rpm_main 1672 1355 -317 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 80/-380) Total: -300 bytes Signed-off-by: Denys Vlasenko --- include/libbb.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index 976120e72..2f67c7f72 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -651,6 +651,15 @@ extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p) FAST_FUNC; extern void *xmalloc_read(int fd, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; /* Returns NULL if file can't be opened (default max size: INT_MAX - 4095) */ extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; +/* Autodetects gzip/bzip2 formats. fd may be in the middle of the file! */ +#if ENABLE_FEATURE_SEAMLESS_LZMA \ + || ENABLE_FEATURE_SEAMLESS_BZ2 \ + || ENABLE_FEATURE_SEAMLESS_GZ \ + /* || ENABLE_FEATURE_SEAMLESS_Z */ +extern int setup_unzip_on_fd(int fd /*, int fail_if_not_detected*/) FAST_FUNC; +#else +# define setup_unzip_on_fd(...) ((void)0) +#endif /* Autodetects .gz etc */ extern int open_zipped(const char *fname) FAST_FUNC; extern void *xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; -- cgit v1.2.3