c2dfb7
From 09c96d5ef3f2b0bc4e5f1cf69e9b66248e325509 Mon Sep 17 00:00:00 2001
c2dfb7
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
c2dfb7
Date: Mon, 29 Oct 2018 18:32:51 +0100
c2dfb7
Subject: [PATCH] Drop support for lz4 < 1.3.0
c2dfb7
c2dfb7
lz4-r130 was released on May 29th, 2015. Let's drop the work-around for older
c2dfb7
versions. In particular, we won't test any new code against those ancient
c2dfb7
releases, so we shouldn't pretend they are supported.
c2dfb7
c2dfb7
(cherry picked from commit e0a1d4b049e6991919a0eacd5d96f7f39dc6ddd1)
c2dfb7
Resolves: #1843871
c2dfb7
---
c2dfb7
 README                      | 2 +-
c2dfb7
 meson.build                 | 1 +
c2dfb7
 src/journal/compress.c      | 4 ----
c2dfb7
 src/journal/test-compress.c | 4 ----
c2dfb7
 4 files changed, 2 insertions(+), 9 deletions(-)
c2dfb7
c2dfb7
diff --git a/README b/README
c2dfb7
index 7d06e04800..859152fbde 100644
c2dfb7
--- a/README
c2dfb7
+++ b/README
c2dfb7
@@ -148,7 +148,7 @@ REQUIREMENTS:
c2dfb7
         libacl (optional)
c2dfb7
         libselinux (optional)
c2dfb7
         liblzma (optional)
c2dfb7
-        liblz4 >= 119 (optional)
c2dfb7
+        liblz4 >= 1.3.0 / 130 (optional)
c2dfb7
         libgcrypt (optional)
c2dfb7
         libqrencode (optional)
c2dfb7
         libmicrohttpd (optional)
c2dfb7
diff --git a/meson.build b/meson.build
c2dfb7
index 70811c29cf..c8ae1e15bd 100644
c2dfb7
--- a/meson.build
c2dfb7
+++ b/meson.build
c2dfb7
@@ -1076,6 +1076,7 @@ conf.set10('HAVE_XZ', have)
c2dfb7
 want_lz4 = get_option('lz4')
c2dfb7
 if want_lz4 != 'false' and not fuzzer_build
c2dfb7
         liblz4 = dependency('liblz4',
c2dfb7
+                            version : '>= 1.3.0',
c2dfb7
                             required : want_lz4 == 'true')
c2dfb7
         have = liblz4.found()
c2dfb7
 else
c2dfb7
diff --git a/src/journal/compress.c b/src/journal/compress.c
c2dfb7
index 6baf15c8ff..a4a5e63840 100644
c2dfb7
--- a/src/journal/compress.c
c2dfb7
+++ b/src/journal/compress.c
c2dfb7
@@ -95,11 +95,7 @@ int compress_blob_lz4(const void *src, uint64_t src_size,
c2dfb7
         if (src_size < 9)
c2dfb7
                 return -ENOBUFS;
c2dfb7
 
c2dfb7
-#if LZ4_VERSION_NUMBER >= 10700
c2dfb7
         r = LZ4_compress_default(src, (char*)dst + 8, src_size, (int) dst_alloc_size - 8);
c2dfb7
-#else
c2dfb7
-        r = LZ4_compress_limitedOutput(src, (char*)dst + 8, src_size, (int) dst_alloc_size - 8);
c2dfb7
-#endif
c2dfb7
         if (r <= 0)
c2dfb7
                 return -ENOBUFS;
c2dfb7
 
c2dfb7
diff --git a/src/journal/test-compress.c b/src/journal/test-compress.c
c2dfb7
index 791c6fdffb..eb3dc3eb6b 100644
c2dfb7
--- a/src/journal/test-compress.c
c2dfb7
+++ b/src/journal/test-compress.c
c2dfb7
@@ -207,11 +207,7 @@ static void test_lz4_decompress_partial(void) {
c2dfb7
         memset(huge, 'x', HUGE_SIZE);
c2dfb7
         memcpy(huge, "HUGE=", 5);
c2dfb7
 
c2dfb7
-#if LZ4_VERSION_NUMBER >= 10700
c2dfb7
         r = LZ4_compress_default(huge, buf, HUGE_SIZE, buf_size);
c2dfb7
-#else
c2dfb7
-        r = LZ4_compress_limitedOutput(huge, buf, HUGE_SIZE, buf_size);
c2dfb7
-#endif
c2dfb7
         assert_se(r >= 0);
c2dfb7
         compressed = r;
c2dfb7
         log_info("Compressed %i → %zu", HUGE_SIZE, compressed);