]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/journal/test-compress.c
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / journal / test-compress.c
index bd0ffaffbf3caef7c94dabbb3d533c20110e4111..1b9b186be37ad61223d0cf527642304973dbb1ef 100644 (file)
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1+ */
 /***
   This file is part of systemd
 
@@ -17,7 +18,7 @@
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
 #include <lz4.h>
 #endif
 
 #include "random-util.h"
 #include "util.h"
 
-#ifdef HAVE_XZ
+#if HAVE_XZ
 # define XZ_OK 0
 #else
 # define XZ_OK -EPROTONOSUPPORT
 #endif
 
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
 # define LZ4_OK 0
 #else
 # define LZ4_OK -EPROTONOSUPPORT
@@ -54,7 +55,7 @@ typedef int (decompress_sw_t)(const void *src, uint64_t src_size,
 typedef int (compress_stream_t)(int fdf, int fdt, uint64_t max_bytes);
 typedef int (decompress_stream_t)(int fdf, int fdt, uint64_t max_size);
 
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
 static void test_compress_decompress(int compression,
                                      compress_blob_t compress,
                                      decompress_blob_t decompress,
@@ -206,7 +207,7 @@ static void test_compress_stream(int compression,
 }
 #endif
 
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
 static void test_lz4_decompress_partial(void) {
         char buf[20000];
         size_t buf_size = sizeof(buf), compressed;
@@ -249,7 +250,7 @@ static void test_lz4_decompress_partial(void) {
 #endif
 
 int main(int argc, char *argv[]) {
-#if defined(HAVE_XZ) || defined(HAVE_LZ4)
+#if HAVE_XZ || HAVE_LZ4
         const char text[] =
                 "text\0foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF"
                 "foofoofoofoo AAAA aaaaaaaaa ghost busters barbarbar FFF";
@@ -268,7 +269,7 @@ int main(int argc, char *argv[]) {
 
         random_bytes(data + 7, sizeof(data) - 7);
 
-#ifdef HAVE_XZ
+#if HAVE_XZ
         test_compress_decompress(OBJECT_COMPRESSED_XZ, compress_blob_xz, decompress_blob_xz,
                                  text, sizeof(text), false);
         test_compress_decompress(OBJECT_COMPRESSED_XZ, compress_blob_xz, decompress_blob_xz,
@@ -290,7 +291,7 @@ int main(int argc, char *argv[]) {
         log_info("/* XZ test skipped */");
 #endif
 
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
         test_compress_decompress(OBJECT_COMPRESSED_LZ4, compress_blob_lz4, decompress_blob_lz4,
                                  text, sizeof(text), false);
         test_compress_decompress(OBJECT_COMPRESSED_LZ4, compress_blob_lz4, decompress_blob_lz4,