diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-03-06 09:25:14 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-03-06 09:30:28 +0900 |
commit | ce16d177ddaa6b9fe1f4a40243185bf18ac1915e (patch) | |
tree | cc0b0f3c334f5944f6089fd06b883869e7db3a03 /src/basic/io-util.h | |
parent | a0229fb14d8df6883f6b9e30a1299d08e668f6a2 (diff) | |
download | systemd-ce16d177ddaa6b9fe1f4a40243185bf18ac1915e.tar.gz |
tree-wide: replace IOVEC_INIT with IOVEC_MAKE
We use gnu11 to build, hence we can use structured initializer with
casting, and it is not necessary to use different patterns on
initialization and assignment.
Addresses https://github.com/systemd/systemd/pull/26560#discussion_r1118875447.
Diffstat (limited to 'src/basic/io-util.h')
-rw-r--r-- | src/basic/io-util.h | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/basic/io-util.h b/src/basic/io-util.h index a5c1f89a8d..3ad8267962 100644 --- a/src/basic/io-util.h +++ b/src/basic/io-util.h @@ -75,14 +75,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) \ +#define IOVEC_MAKE(base, len) (struct iovec) { .iov_base = (base), .iov_len = (len) } +#define IOVEC_MAKE_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); |