From dde263747623c188306f6ed43212de202e977272 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 30 Oct 2017 19:54:13 +0100 Subject: [PATCH] journal: make use of IOVEC_MAKE() where it makes sense --- src/journal/journald-audit.c | 8 ++------ src/journal/journald-native.c | 10 +++------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/journal/journald-audit.c b/src/journal/journald-audit.c index 3334418..f79983d 100644 --- a/src/journal/journald-audit.c +++ b/src/journal/journald-audit.c @@ -61,9 +61,7 @@ static int map_simple_field(const char *field, const char **p, struct iovec **io if (!GREEDY_REALLOC(*iov, *n_iov_allocated, *n_iov + 1)) return -ENOMEM; - (*iov)[*n_iov].iov_base = c; - (*iov)[*n_iov].iov_len = l; - (*n_iov)++; + (*iov)[(*n_iov)++] = IOVEC_MAKE(c, l); *p = e; c = NULL; @@ -140,9 +138,7 @@ static int map_string_field_internal(const char *field, const char **p, struct i if (!GREEDY_REALLOC(*iov, *n_iov_allocated, *n_iov + 1)) return -ENOMEM; - (*iov)[*n_iov].iov_base = c; - (*iov)[*n_iov].iov_len = l; - (*n_iov)++; + (*iov)[(*n_iov)++] = IOVEC_MAKE(c, l); *p = e; c = NULL; diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c index 0953324..d1fdfcc 100644 --- a/src/journal/journald-native.c +++ b/src/journal/journald-native.c @@ -172,14 +172,10 @@ static int server_process_entry( l = e - p; - /* If the field name starts with an - * underscore, skip the variable, - * since that indicates a trusted - * field */ - iovec[n].iov_base = (char*) p; - iovec[n].iov_len = l; + /* If the field name starts with an underscore, skip the variable, since that indicates + * a trusted field */ + iovec[n++] = IOVEC_MAKE((char*) p, l); entry_size += l; - n++; server_process_entry_meta(p, l, ucred, &priority, -- 2.7.4