make iob_reset actually free the buffers
This commit is contained in:
parent
543987da58
commit
0ba7b25005
@ -1,5 +1,5 @@
|
||||
#include "iob_internal.h"
|
||||
|
||||
int iob_addbuf(io_batch* b,const void* buf,uint64 n) {
|
||||
int iob_addbuf_free(io_batch* b,const void* buf,uint64 n) {
|
||||
return iob_addbuf_internal(b,buf,n,1);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "str.h"
|
||||
#include "iob.h"
|
||||
|
||||
int iob_adds(io_batch* b,const char* s) {
|
||||
int iob_adds_free(io_batch* b,const char* s) {
|
||||
return iob_addbuf_free(b,s,str_len(s));
|
||||
}
|
||||
|
@ -3,6 +3,13 @@
|
||||
#include "iob_internal.h"
|
||||
|
||||
void iob_reset(io_batch* b) {
|
||||
unsigned long i,l;
|
||||
iob_entry* x=array_start(&b->b);
|
||||
l=array_length(&b->b,sizeof(iob_entry));
|
||||
for (i=0; i<l; ++i) {
|
||||
if (x[i].type==FROMBUF_FREE)
|
||||
free((char*)x[i].buf);
|
||||
}
|
||||
array_reset(&b->b);
|
||||
byte_zero(b,sizeof(*b));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user