summaryrefslogtreecommitdiff
path: root/libarchive/archive_util.c
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@acm.org>2017-03-11 15:30:38 -0800
committerTim Kientzle <kientzle@acm.org>2017-03-11 15:30:38 -0800
commit45a0bce146428e21b35119fe4da901da56f182dd (patch)
tree06e14151412e7013174ed401e08a1416fd41f9d7 /libarchive/archive_util.c
parentfea0fb4db0d042f7491f6a4f3fdd166c8887cb21 (diff)
downloadlibarchive-45a0bce146428e21b35119fe4da901da56f182dd.tar.gz
Break out the library version functions into a separate source file.
This breaks a static dependency on libbz2. Before this, any use of libarchive that ended up linking archive_util.c would require libbz2. (And since archive_util.c contains a bunch of very core functions, this is pretty much everybody.) Now you only require libbz2 if you request library version information or actually use some other feature that involves bzip2 support. Note that most of the libraries provide version information via compile-time macros -- libbz2 only provides such information via a function call, which is why this issue only arises with libbz2. In particular, the libbz2 version reports the version that we are currently linked against; the other library versions report the version we were compiled with (which may not be the same as what we are currently using).
Diffstat (limited to 'libarchive/archive_util.c')
-rw-r--r--libarchive/archive_util.c82
1 files changed, 0 insertions, 82 deletions
diff --git a/libarchive/archive_util.c b/libarchive/archive_util.c
index 6b3bd611..a751868f 100644
--- a/libarchive/archive_util.c
+++ b/libarchive/archive_util.c
@@ -89,88 +89,6 @@ archive_version_string(void)
return (ARCHIVE_VERSION_STRING);
}
-const char *
-archive_version_details(void)
-{
- static struct archive_string str;
- static int init = 0;
- const char *zlib = archive_zlib_version();
- const char *liblzma = archive_liblzma_version();
- const char *bzlib = archive_bzlib_version();
- const char *liblz4 = archive_liblz4_version();
-
- if (!init) {
- archive_string_init(&str);
-
- archive_strcat(&str, ARCHIVE_VERSION_STRING);
- if (zlib != NULL) {
- archive_strcat(&str, " zlib/");
- archive_strcat(&str, zlib);
- }
- if (liblzma) {
- archive_strcat(&str, " liblzma/");
- archive_strcat(&str, liblzma);
- }
- if (bzlib) {
- const char *p = bzlib;
- const char *sep = strchr(p, ',');
- if (sep == NULL)
- sep = p + strlen(p);
- archive_strcat(&str, " bz2lib/");
- archive_strncat(&str, p, sep - p);
- }
- if (liblz4) {
- archive_strcat(&str, " liblz4/");
- archive_strcat(&str, liblz4);
- }
- }
- return str.s;
-}
-
-const char *
-archive_zlib_version(void)
-{
-#ifdef HAVE_ZLIB_H
- return ZLIB_VERSION;
-#else
- return NULL;
-#endif
-}
-
-const char *
-archive_liblzma_version(void)
-{
-#ifdef HAVE_LZMA_H
- return LZMA_VERSION_STRING;
-#else
- return NULL;
-#endif
-}
-
-const char *
-archive_bzlib_version(void)
-{
-#ifdef HAVE_BZLIB_H
- return BZ2_bzlibVersion();
-#else
- return NULL;
-#endif
-}
-
-const char *
-archive_liblz4_version(void)
-{
-#if defined(HAVE_LZ4_H) && defined(HAVE_LIBLZ4)
-#define str(s) #s
-#define NUMBER(x) str(x)
- return NUMBER(LZ4_VERSION_MAJOR) "." NUMBER(LZ4_VERSION_MINOR) "." NUMBER(LZ4_VERSION_RELEASE);
-#undef NUMBER
-#undef str
-#else
- return NULL;
-#endif
-}
-
int
archive_errno(struct archive *a)
{