summaryrefslogtreecommitdiffstats
path: root/src/basic/io-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2023-10-19 16:01:38 +0200
committerLennart Poettering <lennart@poettering.net>2023-10-20 10:34:33 +0200
commitbd1ae178336a3d9143feea35bb4885c923581e1d (patch)
treeace0e0a86173f28b68adb4359a1f11a44097ddce /src/basic/io-util.c
parentexecutor: return instead of assert on invalid command line arguments (diff)
downloadsystemd-bd1ae178336a3d9143feea35bb4885c923581e1d.tar.xz
systemd-bd1ae178336a3d9143feea35bb4885c923581e1d.zip
io-util: split out "struct iovec" related calls into their own .c/.h files
This is preparation for #28891, which adds a bunch more helpers around "struct iovec", at which point this really deserves its own .c/.h file. The idea is that we sooner or later can consider "struct iovec" as an entirely generic mechanism to reference some binary blob, and is the go-to type for this purpose whenever we need one.
Diffstat (limited to 'src/basic/io-util.c')
-rw-r--r--src/basic/io-util.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/src/basic/io-util.c b/src/basic/io-util.c
index 25831e47dc..eda4f1fac3 100644
--- a/src/basic/io-util.c
+++ b/src/basic/io-util.c
@@ -7,6 +7,7 @@
#include "errno-util.h"
#include "io-util.h"
+#include "iovec-util.h"
#include "string-util.h"
#include "time-util.h"
@@ -305,23 +306,6 @@ ssize_t sparse_write(int fd, const void *p, size_t sz, size_t run_length) {
return q - (const uint8_t*) p;
}
-char* set_iovec_string_field(struct iovec *iovec, size_t *n_iovec, const char *field, const char *value) {
- char *x;
-
- x = strjoin(field, value);
- if (x)
- iovec[(*n_iovec)++] = IOVEC_MAKE_STRING(x);
- return x;
-}
-
-char* set_iovec_string_field_free(struct iovec *iovec, size_t *n_iovec, const char *field, char *value) {
- char *x;
-
- x = set_iovec_string_field(iovec, n_iovec, field, value);
- free(value);
- return x;
-}
-
struct iovec_wrapper *iovw_new(void) {
return malloc0(sizeof(struct iovec_wrapper));
}
@@ -429,13 +413,3 @@ rollback:
target->count = original_count;
return r;
}
-
-void iovec_array_free(struct iovec *iov, size_t n) {
- if (!iov)
- return;
-
- for (size_t i = 0; i < n; i++)
- free(iov[i].iov_base);
-
- free(iov);
-}