fix buffer_get
This commit is contained in:
parent
4404ab35f3
commit
7c5d119f9a
1
CHANGES
1
CHANGES
@ -15,6 +15,7 @@
|
|||||||
switch io_fds from array to newly implemented (hopefully thread-safe) iarray
|
switch io_fds from array to newly implemented (hopefully thread-safe) iarray
|
||||||
switch epoll from level triggering to edge triggering
|
switch epoll from level triggering to edge triggering
|
||||||
introduce io_eagain_read and io_eagain_write (discontinue using io_eagain plz)
|
introduce io_eagain_read and io_eagain_write (discontinue using io_eagain plz)
|
||||||
|
fix buffer_get
|
||||||
|
|
||||||
0.29:
|
0.29:
|
||||||
save 8 bytes in taia.h for 64-bit systems
|
save 8 bytes in taia.h for 64-bit systems
|
||||||
|
@ -7,7 +7,8 @@ ssize_t buffer_get(buffer* b,char* x,size_t len) {
|
|||||||
done=0;
|
done=0;
|
||||||
if ((ssize_t)len < 0) len=(ssize_t)(((size_t)-1)>>1);
|
if ((ssize_t)len < 0) len=(ssize_t)(((size_t)-1)>>1);
|
||||||
while (len) {
|
while (len) {
|
||||||
if ((blen=buffer_feed(b))<=0) return blen;
|
if ((blen=buffer_feed(b))<0) return blen;
|
||||||
|
if (blen==0) break;
|
||||||
if (blen>=(ssize_t)len)
|
if (blen>=(ssize_t)len)
|
||||||
blen=(ssize_t)len;
|
blen=(ssize_t)len;
|
||||||
byte_copy(x,(size_t)blen,b->x+b->p);
|
byte_copy(x,(size_t)blen,b->x+b->p);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user