]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Prevent unnecessary linking against deflate code 73/head
authorPaul Barker <paul@paulbarker.me.uk>
Thu, 6 Feb 2014 21:20:06 +0000 (21:20 +0000)
committerPaul Barker <paul@paulbarker.me.uk>
Sun, 6 Apr 2014 20:26:47 +0000 (21:26 +0100)
commita9a9683f47118fac905c32873f72d06bdb5f1a1c
tree19518c870639ea07fda78af6bf3c7fe02a7c19f4
parent4d0021541be1ebcb2715a3aa4fa5202efa686b2f
Prevent unnecessary linking against deflate code

In _archive_write_disk_free, the call to deflateEnd was compiled if HAVE_ZLIB_H
was defined. However, all other calls to deflate functions were only compiled
if __APPLE__, UF_COMPRESSED and HAVE_SYS_XATTR_H were also defined. So if one of
these macros was not defined but HAVE_ZLIB_H was defined, the call the
deflateEnd would be unnecessary as deflateInit could never have been called.

In statically linked applications which don't use deflate functions elsewhere
this was causing unnecessary linking of the deflate code from zlib, adding at
least 20k of object code to the final executable size.

This patch fixes the above issue by surrounding the call to deflateEnd with the
same conditional compilation checks as surround the call to deflateInit.

Signed-off-by: Paul Barker <paul@paulbarker.me.uk>
libarchive/archive_write_disk_posix.c