]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/journal/test-compress.c
journal: add dst_allocated_size parameter for compress_blob
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 13 Dec 2015 18:39:12 +0000 (13:39 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 13 Dec 2015 19:54:47 +0000 (14:54 -0500)
commit5d6f46b6bf7804af8c1ba780f72a37dc37193428
treedcf21cb16b15b4a51547de2ab4916a05e8429c40
parent1f4b467daa2999ab0e4345c1f1069567852f567f
journal: add dst_allocated_size parameter for compress_blob

compress_blob took src, src_size, dst and *dst_size, but dst_size
wasn't used as an input parameter with the size of dst, but only as an
output parameter. dst was implicitly assumed to be at least src_size-1.

This code wasn't *wrong*, because the only real caller in
journal-file.c got it right. But it was misleading, and the tests in
test-compress.c got it wrong, and worked only because the output
buffer happened to be the same size as input buffer. So add a seperate
dst_allocated_size parameter to make it explicit what the size of the
buffer is, and to allow test to proceed with different output buffer
sizes.
src/journal/compress.c
src/journal/compress.h
src/journal/journal-file.c
src/journal/test-compress-benchmark.c
src/journal/test-compress.c