Line data Source code
1 : /* 2 : * SPDX-License-Identifier: MPL-2.0 3 : * 4 : * This Source Code Form is subject to the terms of the Mozilla Public 5 : * License, v. 2.0. If a copy of the MPL was not distributed with this 6 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. 7 : * 8 : * Copyright 2024 MonetDB Foundation; 9 : * Copyright August 2008 - 2023 MonetDB B.V.; 10 : * Copyright 1997 - July 2008 CWI. 11 : */ 12 : 13 : #include "monetdb_config.h" 14 : #include "stream.h" 15 : #include "stream_internal.h" 16 : 17 : 18 : 19 : static ssize_t 20 0 : stream_blackhole_write(stream *restrict s, const void *restrict buf, size_t elmsize, size_t cnt) 21 : { 22 0 : (void) s; 23 0 : (void) buf; 24 0 : (void) elmsize; 25 0 : return (ssize_t) cnt; 26 : } 27 : 28 : static void 29 0 : stream_blackhole_close(stream *s) 30 : { 31 0 : (void) s; 32 : /* no resources to close */ 33 0 : } 34 : 35 : stream * 36 0 : stream_blackhole_create(void) 37 : { 38 0 : stream *s; 39 0 : if ((s = create_stream("blackhole")) == NULL) { 40 : return NULL; 41 : } 42 : 43 0 : s->read = NULL; 44 0 : s->write = stream_blackhole_write; 45 0 : s->close = stream_blackhole_close; 46 0 : s->flush = NULL; 47 0 : s->readonly = false; 48 0 : return s; 49 : }