aboutsummaryrefslogtreecommitdiff
path: root/lib/io/src/ostream.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-12 18:32:12 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2023-06-15 13:38:25 +0200
commiteb9a4b9034453ae3093d678a6f3898303dc5a5a0 (patch)
treecd024b5ff5e1c77400a561adee50522f10fdadcd /lib/io/src/ostream.c
parent63bc750fecb00fc5878ca889204fc65510893778 (diff)
libio: remove ostream_append_sparse and fallback implementation
Instead of a separate append-sparse function, simply accept NULL as an input for append. For both Unix and Win32, a fallback needs to be implemented. For XFRM, we can just memset the input buffer to zero, same for the libsquashfs data writer. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/io/src/ostream.c')
-rw-r--r--lib/io/src/ostream.c35
1 files changed, 0 insertions, 35 deletions
diff --git a/lib/io/src/ostream.c b/lib/io/src/ostream.c
deleted file mode 100644
index 35f98d4..0000000
--- a/lib/io/src/ostream.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* SPDX-License-Identifier: GPL-3.0-or-later */
-/*
- * ostream.c
- *
- * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at>
- */
-#include "internal.h"
-
-
-static int append_sparse_fallback(ostream_t *strm, size_t size)
-{
- char buffer[512];
- size_t diff;
-
- memset(buffer, 0, sizeof(buffer));
-
- while (size > 0) {
- diff = size < sizeof(buffer) ? size : sizeof(buffer);
-
- if (strm->append(strm, buffer, diff))
- return -1;
-
- size -= diff;
- }
-
- return 0;
-}
-
-int ostream_append_sparse(ostream_t *strm, size_t size)
-{
- if (strm->append_sparse == NULL)
- return append_sparse_fallback(strm, size);
-
- return strm->append_sparse(strm, size);
-}