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