From: Lennart Poettering Date: Sat, 15 May 2010 15:22:58 +0000 (+0200) Subject: macro: interpret arguments to IOVEC_SET_STRING only once X-Git-Tag: v1~398 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=bff7c062a40379c0797c34f0f3d159e3c6126a29 macro: interpret arguments to IOVEC_SET_STRING only once --- diff --git a/macro.h b/macro.h index 2379ee2de..622c08eed 100644 --- a/macro.h +++ b/macro.h @@ -117,10 +117,12 @@ static inline size_t ALIGN(size_t l) { #define char_array_0(x) x[sizeof(x)-1] = 0; -#define IOVEC_SET_STRING(iovec, s) \ +#define IOVEC_SET_STRING(i, s) \ do { \ - (iovec).iov_base = s; \ - (iovec).iov_len = strlen(s); \ + struct iovec *_i = &(i); \ + char *_s = (char *)(s); \ + _i->iov_base = _s; \ + _i->iov_len = strlen(_s); \ } while(false); #include "log.h"