/* This duplicates the source and merges it into the target. */
- if (!source || source->count == 0)
+ if (iovw_isempty(source))
return 0;
original_count = target->count;
int iovw_put(struct iovec_wrapper *iovw, void *data, size_t len);
static inline int iovw_consume(struct iovec_wrapper *iovw, void *data, size_t len) {
/* Move data into iovw or free on error */
- int r = iovw_put(iovw, data, len);
+ int r;
+
+ r = iovw_put(iovw, data, len);
if (r < 0)
free(data);
+
return r;
}
+static inline bool iovw_isempty(const struct iovec_wrapper *iovw) {
+ return !iovw || iovw->count == 0;
+}
+
int iovw_put_string_field(struct iovec_wrapper *iovw, const char *field, const char *value);
int iovw_put_string_field_free(struct iovec_wrapper *iovw, const char *field, char *value);
void iovw_rebase(struct iovec_wrapper *iovw, char *old, char *new);
int r;
assert(w);
- assert(iovw);
- assert(iovw->count > 0);
+ assert(!iovw_isempty(iovw));
if (journal_file_rotate_suggested(w->journal->file, 0, LOG_DEBUG)) {
log_info("%s: Journal header limits reached or header out-of-date, rotating",