iovec-wrapper: make iovw_size() take NULL again

This partially reverts 267b16f33c.

We usually make xyz_size() take NULL, e.g. hashmap_size().
This commit is contained in:
Yu Watanabe
2026-04-24 03:27:36 +09:00
parent 2fcf963273
commit 58863bdaec
2 changed files with 4 additions and 1 deletions

View File

@@ -237,7 +237,8 @@ void iovw_rebase(struct iovec_wrapper *iovw, void *old, void *new) {
}
size_t iovw_size(const struct iovec_wrapper *iovw) {
assert(iovw);
if (iovw_isempty(iovw))
return 0;
return iovec_total_size(iovw->iovec, iovw->count);
}

View File

@@ -393,6 +393,8 @@ TEST(iovw_size) {
ASSERT_OK(iovw_put(&iovw, (char*) "efghij", 6));
ASSERT_OK(iovw_put(&iovw, (char*) "kl", 2));
ASSERT_EQ(iovw_size(&iovw), 12U);
ASSERT_EQ(iovw_size(NULL), 0U);
}
TEST(iovw_concat) {