X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/71b70599a2cd81c13cc4326499a5d0c45358cd7d..a4243347741f0f7079858e03bca8fc32990f525c:/lib/sink.c?ds=sidebyside diff --git a/lib/sink.c b/lib/sink.c index 245ee26..e904005 100644 --- a/lib/sink.c +++ b/lib/sink.c @@ -1,6 +1,6 @@ /* * This file is part of DisOrder - * Copyright (C) 2004 Richard Kettlewell + * Copyright (C) 2004, 2007, 2008 Richard Kettlewell * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -131,6 +131,22 @@ struct sink *sink_dynstr(struct dynstr *output) { return (struct sink *)s; } +/* discard sink **************************************************************/ + +static int sink_discard_write(struct sink attribute((unused)) *s, + const void attribute((unused)) *buffer, + int nbytes) { + return nbytes; +} + +/** @brief Return a sink which discards all output */ +struct sink *sink_discard(void) { + struct sink *s = xmalloc(sizeof *s); + + s->write = sink_discard_write; + return s; +} + /* Local Variables: c-basic-offset:2