From 6319ac5225aec738f134f338f68109822581bff1 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sat, 6 Dec 2014 17:51:14 +0000 Subject: Rewrite unixmessage_receiver without buffer, only cbuffer --- src/libstddjb/buffer_fill.c | 2 +- src/libstddjb/buffer_flush.c | 4 ++-- src/libstddjb/buffer_flush1read.c | 4 ++-- src/libstddjb/buffer_init.c | 4 ++-- src/libstddjb/buffer_read.c | 5 ++--- src/libstddjb/buffer_write.c | 5 ++--- 6 files changed, 11 insertions(+), 13 deletions(-) (limited to 'src/libstddjb') diff --git a/src/libstddjb/buffer_fill.c b/src/libstddjb/buffer_fill.c index c158abe..07a916b 100644 --- a/src/libstddjb/buffer_fill.c +++ b/src/libstddjb/buffer_fill.c @@ -10,7 +10,7 @@ int buffer_fill (buffer *b) register int r ; if (buffer_isfull(b)) return (errno = ENOBUFS, -1) ; buffer_wpeek(b, v) ; - r = (*b->op)(b->fd, v, 2, b->aux) ; + r = (*b->op)(b->fd, v, 2) ; if (r <= 0) return r ; cbuffer_WSEEK(&b->c, r) ; return r ; diff --git a/src/libstddjb/buffer_flush.c b/src/libstddjb/buffer_flush.c index ca6ca6b..46512fc 100644 --- a/src/libstddjb/buffer_flush.c +++ b/src/libstddjb/buffer_flush.c @@ -1,8 +1,8 @@ /* ISC license. */ -#include #include #include +#include int buffer_flush (buffer *b) { @@ -12,7 +12,7 @@ int buffer_flush (buffer *b) register int r ; buffer_rpeek(b, v) ; if (!v[0].len && !v[1].len) break ; - r = (*b->op)(b->fd, v, 2, b->aux) ; + r = (*b->op)(b->fd, v, 2) ; if (r <= 0) return 0 ; cbuffer_RSEEK(&b->c, r) ; } diff --git a/src/libstddjb/buffer_flush1read.c b/src/libstddjb/buffer_flush1read.c index 9dcdf81..1a771ea 100644 --- a/src/libstddjb/buffer_flush1read.c +++ b/src/libstddjb/buffer_flush1read.c @@ -3,8 +3,8 @@ #include #include -int buffer_flush1read (int fd, siovec_t const *v, unsigned int n, void *aux) +int buffer_flush1read (int fd, siovec_t const *v, unsigned int n) { if (!buffer_flush(buffer_1)) return -1 ; - return buffer_read(fd, v, n, aux) ; + return buffer_read(fd, v, n) ; } diff --git a/src/libstddjb/buffer_init.c b/src/libstddjb/buffer_init.c index 09d4910..2831fe1 100644 --- a/src/libstddjb/buffer_init.c +++ b/src/libstddjb/buffer_init.c @@ -1,13 +1,13 @@ /* ISC license. */ #include +#include #include -int buffer_init_aux (buffer *b, buffer_io_func_t *op, int fd, char *s, unsigned int len, void *aux) +int buffer_init (buffer *b, buffer_io_func_t *op, int fd, char *s, unsigned int len) { if (!cbuffer_init(&b->c, s, len)) return 0 ; b->fd = fd ; b->op = op ; - b->aux = aux ; return 1 ; } diff --git a/src/libstddjb/buffer_read.c b/src/libstddjb/buffer_read.c index 150bc15..88003b4 100644 --- a/src/libstddjb/buffer_read.c +++ b/src/libstddjb/buffer_read.c @@ -3,13 +3,12 @@ #include #include #include -#include #include +#include -int buffer_read (int fd, siovec_t const *v, unsigned int n, void *aux) +int buffer_read (int fd, siovec_t const *v, unsigned int n) { struct iovec iov[n] ; iovec_from_siovec(iov, v, n) ; - (void)aux ; return fd_readv(fd, iov, n) ; } diff --git a/src/libstddjb/buffer_write.c b/src/libstddjb/buffer_write.c index 40ffd46..e669f60 100644 --- a/src/libstddjb/buffer_write.c +++ b/src/libstddjb/buffer_write.c @@ -3,13 +3,12 @@ #include #include #include -#include #include +#include -int buffer_write (int fd, siovec_t const *v, unsigned int n, void *aux) +int buffer_write (int fd, siovec_t const *v, unsigned int n) { struct iovec iov[n] ; iovec_from_siovec(iov, v, n) ; - (void)aux ; return fd_writev(fd, iov, n) ; } -- cgit v1.2.3