iovec-util: make IOVEC_TOTAL_SIZE() a regular function

The function isn't necessarily fast (it's O(n)), and there's no reason
to have it defined as inline function, since it's neither fast, nor
entirely trivial.
This commit is contained in:
Lennart Poettering
2023-10-20 10:43:50 +02:00
parent bd1ae17833
commit c24e0dbea1
7 changed files with 19 additions and 16 deletions
+10
View File
@@ -3,6 +3,16 @@
#include "iovec-util.h"
#include "string-util.h"
size_t iovec_total_size(const struct iovec *i, size_t n) {
size_t sum = 0;
assert(i || n == 0);
FOREACH_ARRAY(j, i, n)
sum += j->iov_len;
return sum;
}
char* set_iovec_string_field(struct iovec *iovec, size_t *n_iovec, const char *field, const char *value) {
char *x;
+1 -8
View File
@@ -7,14 +7,7 @@
#include "macro.h"
static inline size_t IOVEC_TOTAL_SIZE(const struct iovec *i, size_t n) {
size_t r = 0;
for (size_t j = 0; j < n; j++)
r += i[j].iov_len;
return r;
}
size_t iovec_total_size(const struct iovec *i, size_t n);
static inline bool IOVEC_INCREMENT(struct iovec *i, size_t n, size_t k) {
/* Returns true if there is nothing else to send (bytes written cover all of the iovec),