X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/d22b8a59995829bc14b4490b9bddd95346e0585d..ec7109f36e878732d30e592279c2b160b28e6955:/lib/sink.c diff --git a/lib/sink.c b/lib/sink.c index e904005..925bb01 100644 --- a/lib/sink.c +++ b/lib/sink.c @@ -21,12 +21,9 @@ * @brief Abstract output sink type */ -#include -#include "types.h" +#include "common.h" -#include #include -#include #include #include "mem.h" @@ -147,6 +144,22 @@ struct sink *sink_discard(void) { return s; } +/* error sink **************************************************************/ + +static int sink_error_write(struct sink attribute((unused)) *s, + const void attribute((unused)) *buffer, + int attribute((unused)) nbytes) { + return -1; +} + +/** @brief Return a sink which discards all output */ +struct sink *sink_error(void) { + struct sink *s = xmalloc(sizeof *s); + + s->write = sink_error_write; + return s; +} + /* Local Variables: c-basic-offset:2