Browse Source

make iob_reset actually free the buffers

master
Felix von Leitner 18 years ago
parent
commit
584e4d4706
  1. 2
      io/iob_addbuf_free.c
  2. 2
      io/iob_adds_free.c
  3. 7
      io/iob_reset.c

2
io/iob_addbuf_free.c

@ -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);
}

2
io/iob_adds_free.c

@ -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));
}

7
io/iob_reset.c

@ -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…
Cancel
Save