remove superfluous #includes
make it possibly to specify that a buffer should be freedmaster
parent
1034218fae
commit
543987da58
@ -1,15 +1,5 @@
|
||||
#include "iob_internal.h"
|
||||
|
||||
int iob_addbuf(io_batch* b,const void* buf,uint64 n) {
|
||||
iob_entry* e=array_allocate(&b->b,sizeof(iob_entry),
|
||||
array_length(&b->b,sizeof(iob_entry)));
|
||||
if (!e) return 0;
|
||||
e->type=FROMBUF;
|
||||
e->fd=-1;
|
||||
e->buf=buf;
|
||||
e->n=n;
|
||||
e->offset=0;
|
||||
b->bytesleft+=n;
|
||||
++b->bufs;
|
||||
return 1;
|
||||
return iob_addbuf_internal(b,buf,n,0);
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
#include "iob_internal.h"
|
||||
|
||||
int iob_addbuf(io_batch* b,const void* buf,uint64 n) {
|
||||
return iob_addbuf_internal(b,buf,n,1);
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
#include "iob_internal.h"
|
||||
|
||||
int iob_addbuf_internal(io_batch* b,const void* buf,uint64 n,int _free) {
|
||||
iob_entry* e=array_allocate(&b->b,sizeof(iob_entry),
|
||||
array_length(&b->b,sizeof(iob_entry)));
|
||||
if (!e) return 0;
|
||||
e->type=_free?FROMBUF_FREE:FROMBUF;
|
||||
e->fd=-1;
|
||||
e->buf=buf;
|
||||
e->n=n;
|
||||
e->offset=0;
|
||||
b->bytesleft+=n;
|
||||
++b->bufs;
|
||||
return 1;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
#include "str.h"
|
||||
#include "iob.h"
|
||||
|
||||
int iob_adds(io_batch* b,const char* s) {
|
||||
return iob_addbuf_free(b,s,str_len(s));
|
||||
}
|
Loading…
Reference in New Issue