io-util: drop double evaluation in IOVEC_INIT_STRING()

This also makes IOVEC_INIT_STRING() and IOVEC_MAKE_STRING() identical.
This commit is contained in:
Yu Watanabe
2023-02-23 15:09:59 +09:00
parent 65e7d565e4
commit de5cc016b5
+6 -2
View File
@@ -77,8 +77,12 @@ static inline bool FILE_SIZE_VALID_OR_INFINITY(uint64_t l) {
#define IOVEC_NULL (struct iovec) {}
#define IOVEC_INIT(base, len) { .iov_base = (base), .iov_len = (len) }
#define IOVEC_MAKE(base, len) (struct iovec) IOVEC_INIT(base, len)
#define IOVEC_INIT_STRING(string) IOVEC_INIT((char*) string, strlen(string))
#define IOVEC_MAKE_STRING(string) (struct iovec) IOVEC_INIT_STRING(string)
#define IOVEC_INIT_STRING(string) \
({ \
char *_s = (char*) (string); \
IOVEC_MAKE(_s, strlen(_s)); \
})
#define IOVEC_MAKE_STRING(string) IOVEC_INIT_STRING(string)
char* set_iovec_string_field(struct iovec *iovec, size_t *n_iovec, const char *field, const char *value);
char* set_iovec_string_field_free(struct iovec *iovec, size_t *n_iovec, const char *field, char *value);