Remove reduntant code

This commit is contained in:
cpq committed 2021-02-15 14:42:22 +00:00
1 parent 51e3a1304b
commit 7ce5009de1
1 file changed
+2 -7
+2 -7
View File
@@ -28,11 +28,7 @@ int mg_iobuf_resize(struct mg_iobuf *io, size_t new_size) {
} }
int mg_iobuf_init(struct mg_iobuf *io, size_t size) { int mg_iobuf_init(struct mg_iobuf *io, size_t size) {
int ok = 1; return mg_iobuf_resize(io, size);
io->buf = NULL;
io->len = io->size = 0;
if (size > 0) ok = mg_iobuf_resize(io, size);
return ok;
} }
size_t mg_iobuf_append(struct mg_iobuf *io, const void *buf, size_t len, size_t mg_iobuf_append(struct mg_iobuf *io, const void *buf, size_t len,
@@ -54,6 +50,5 @@ size_t mg_iobuf_delete(struct mg_iobuf *io, size_t len) {
} }
void mg_iobuf_free(struct mg_iobuf *io) { void mg_iobuf_free(struct mg_iobuf *io) {
free(io->buf); mg_iobuf_resize(io, 0);
mg_iobuf_init(io, 0);
} }