]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: Fix build with !HAVE_LZ4 && HAVE_XZ
authorMichal Koutný <mkoutny@suse.com>
Fri, 1 May 2020 16:38:10 +0000 (18:38 +0200)
committerTopi Miettinen <topimiettinen@users.noreply.github.com>
Sat, 2 May 2020 20:04:36 +0000 (20:04 +0000)
HUGE_SIZE was defined inconsistently.

> In file included from ../src/basic/alloc-util.h:9,
>                  from ../src/journal/test-compress.c:9:
> ../src/journal/test-compress.c: In function ‘main’:
> ../src/journal/test-compress.c:280:33: error: ‘HUGE_SIZE’ undeclared (first use in this function)
>   280 |         assert_se(huge = malloc(HUGE_SIZE));

src/journal/test-compress.c

index 6d738f4d66f3da653b36a7eb3de8a7623fc3e82d..0b2898e10995ac265f79e2ee6db654e7b8a9ab64 100644 (file)
@@ -29,6 +29,8 @@
 # define LZ4_OK -EPROTONOSUPPORT
 #endif
 
+#define HUGE_SIZE (4096*1024)
+
 typedef int (compress_blob_t)(const void *src, uint64_t src_size,
                               void *dst, size_t dst_alloc_size, size_t *dst_size);
 typedef int (decompress_blob_t)(const void *src, uint64_t src_size,
@@ -231,7 +233,6 @@ static void test_lz4_decompress_partial(void) {
         int r;
         _cleanup_free_ char *huge = NULL;
 
-#define HUGE_SIZE (4096*1024)
         assert_se(huge = malloc(HUGE_SIZE));
         memcpy(huge, "HUGE=", STRLEN("HUGE="));
         memset(&huge[STRLEN("HUGE=")], 'x', HUGE_SIZE - STRLEN("HUGE=") - 1);