Commit graph

5 commits

Author SHA1 Message Date
Lennart Poettering e6a7ec4b8e io-util: add new IOVEC_INIT/IOVEC_MAKE macros
This adds IOVEC_INIT() and IOVEC_MAKE() for initializing iovec structures
from a pointer and a size. On top of these IOVEC_INIT_STRING() and
IOVEC_MAKE_STRING() are added which take a string and automatically
determine the size of the string using strlen().

This patch removes the old IOVEC_SET_STRING() macro, given that
IOVEC_MAKE_STRING() is now useful for similar purposes. Note that the
old IOVEC_SET_STRING() invocations were two characters shorter than the
new ones using IOVEC_MAKE_STRING(), but I think the new syntax is more
readable and more generic as it simply resolves to a C99 literal
structure initialization. Moreover, we can use very similar syntax now
for initializing strings and pointer+size iovec entries. We canalso use
the new macros to initialize function parameters on-the-fly or array
definitions. And given that we shouldn't have so many ways to do the
same stuff, let's just settle on the new macros.

(This also converts some code to use _cleanup_ where dynamically
allocated strings were using IOVEC_SET_STRING() before, to modernize
things a bit)
2017-09-22 15:28:04 +02:00
Zbigniew Jędrzejewski-Szmek 2ddb70d26f journal-remote: fix memleak of the name of the remote source 2017-05-19 11:40:56 -04:00
John Paul Adrian Glaubitz f652c62d71 basic/journal-importer: Fix unaligned access in get_data_size() (#5622) 2017-03-21 22:36:50 -04:00
Zbigniew Jędrzejewski-Szmek d74dc4f2d0 coredump: fix handling of premature-eof data for --backtrace
We'd fail with an assert in journal_importer_process_data(),
because that function requires the caller to handle EOF themselves.
2017-03-05 10:35:44 -05:00
Zbigniew Jędrzejewski-Szmek b18453eda6 Move export format parsing from src/journal-remote/ to src/basic/
No functional change.
2017-02-14 23:56:48 -05:00