mirror of
https://github.com/systemd/systemd.git
synced 2026-08-07 08:30:57 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user