+/* SPDX-License-Identifier: LGPL-2.1+ */
/***
This file is part of systemd
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
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,
}
#endif
-#ifdef HAVE_LZ4
+#if HAVE_LZ4
static void test_lz4_decompress_partial(void) {
char buf[20000];
size_t buf_size = sizeof(buf), compressed;
#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";
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,
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,