remove superfluous #includes
make it possibly to specify that a buffer should be freed
This commit is contained in:
parent
1034218fae
commit
543987da58
@ -1,6 +1,5 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <poll.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "io_internal.h"
|
#include "io_internal.h"
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <poll.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "io_internal.h"
|
#include "io_internal.h"
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
#include <unistd.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include "io_internal.h"
|
#include "io_internal.h"
|
||||||
|
|
||||||
void io_check() {
|
void io_check() {
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#undef extern
|
#undef extern
|
||||||
#include "byte.h"
|
#include "byte.h"
|
||||||
#ifdef HAVE_SIGIO
|
#ifdef HAVE_SIGIO
|
||||||
#include <sys/poll.h>
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
#include <unistd.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "io_internal.h"
|
#include "io_internal.h"
|
||||||
|
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
#include <unistd.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "io_internal.h"
|
#include "io_internal.h"
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
#include <unistd.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include "io_internal.h"
|
#include "io_internal.h"
|
||||||
|
|
||||||
void io_wait() {
|
void io_wait() {
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
#include <unistd.h>
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <poll.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include "io_internal.h"
|
#include "io_internal.h"
|
||||||
#include "safemult.h"
|
#include "safemult.h"
|
||||||
|
|
||||||
@ -12,5 +8,6 @@ void io_waituntil(tai6464 t) {
|
|||||||
taia_sub(&diff,&t,&now);
|
taia_sub(&diff,&t,&now);
|
||||||
if (!umult64(diff.sec.x,1000,&x) || (y=x+diff.nano/10000000)<x)
|
if (!umult64(diff.sec.x,1000,&x) || (y=x+diff.nano/10000000)<x)
|
||||||
y=-1; /* overflow; wait indefinitely */
|
y=-1; /* overflow; wait indefinitely */
|
||||||
|
if (!y && diff.nano) y=1;
|
||||||
io_waituntil2(y);
|
io_waituntil2(y);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,5 @@
|
|||||||
#include "iob_internal.h"
|
#include "iob_internal.h"
|
||||||
|
|
||||||
int iob_addbuf(io_batch* b,const void* buf,uint64 n) {
|
int iob_addbuf(io_batch* b,const void* buf,uint64 n) {
|
||||||
iob_entry* e=array_allocate(&b->b,sizeof(iob_entry),
|
return iob_addbuf_internal(b,buf,n,0);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
5
io/iob_addbuf_free.c
Normal file
5
io/iob_addbuf_free.c
Normal file
@ -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);
|
||||||
|
}
|
15
io/iob_addbuf_internal.c
Normal file
15
io/iob_addbuf_internal.c
Normal file
@ -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;
|
||||||
|
}
|
6
io/iob_adds_free.c
Normal file
6
io/iob_adds_free.c
Normal file
@ -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…
x
Reference in New Issue
Block a user