basic/iovec-wrapper: drop unused code
All non-test users iovec_wrapper define the struct as a field in a bigger structure, so we never free it individually. Let's simplify the code and assume it is never null.
This commit is contained in:
@@ -7,10 +7,6 @@
|
||||
#include "iovec-wrapper.h"
|
||||
#include "string-util.h"
|
||||
|
||||
struct iovec_wrapper *iovw_new(void) {
|
||||
return new0(struct iovec_wrapper, 1);
|
||||
}
|
||||
|
||||
void iovw_done(struct iovec_wrapper *iovw) {
|
||||
assert(iovw);
|
||||
|
||||
@@ -27,22 +23,6 @@ void iovw_done_free(struct iovec_wrapper *iovw) {
|
||||
iovw_done(iovw);
|
||||
}
|
||||
|
||||
struct iovec_wrapper *iovw_free_free(struct iovec_wrapper *iovw) {
|
||||
if (!iovw)
|
||||
return NULL;
|
||||
|
||||
iovw_done_free(iovw);
|
||||
return mfree(iovw);
|
||||
}
|
||||
|
||||
struct iovec_wrapper *iovw_free(struct iovec_wrapper *iovw) {
|
||||
if (!iovw)
|
||||
return NULL;
|
||||
|
||||
iovw_done(iovw);
|
||||
return mfree(iovw);
|
||||
}
|
||||
|
||||
int iovw_put(struct iovec_wrapper *iovw, void *data, size_t len) {
|
||||
assert(iovw);
|
||||
|
||||
@@ -118,8 +98,7 @@ void iovw_rebase(struct iovec_wrapper *iovw, void *old, void *new) {
|
||||
}
|
||||
|
||||
size_t iovw_size(const struct iovec_wrapper *iovw) {
|
||||
if (!iovw)
|
||||
return 0;
|
||||
assert(iovw);
|
||||
|
||||
return iovec_total_size(iovw->iovec, iovw->count);
|
||||
}
|
||||
|
||||
@@ -8,12 +8,6 @@ struct iovec_wrapper {
|
||||
size_t count;
|
||||
};
|
||||
|
||||
struct iovec_wrapper *iovw_new(void);
|
||||
struct iovec_wrapper *iovw_free(struct iovec_wrapper *iovw);
|
||||
struct iovec_wrapper *iovw_free_free(struct iovec_wrapper *iovw);
|
||||
|
||||
DEFINE_TRIVIAL_CLEANUP_FUNC(struct iovec_wrapper*, iovw_free_free);
|
||||
|
||||
void iovw_done_free(struct iovec_wrapper *iovw);
|
||||
void iovw_done(struct iovec_wrapper *iovw);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user