diff options
author | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-06-26 22:51:27 +0200 |
---|---|---|
committer | David Oberhollenzer <david.oberhollenzer@sigma-star.at> | 2022-07-08 19:17:35 +0200 |
commit | 359d71e90050a8b83f7bc7d2ecd4ff29c477cc22 (patch) | |
tree | df2b7a585b78e6776446d4ca9be62a22db27f0a7 /lib/fstream/compressor.c | |
parent | 2087cc237cd0fe1ed29ebf891648bacb46f4833b (diff) |
Cleanup: rename libfstream to libio, split headers
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'lib/fstream/compressor.c')
-rw-r--r-- | lib/fstream/compressor.c | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/lib/fstream/compressor.c b/lib/fstream/compressor.c deleted file mode 100644 index 48f9567..0000000 --- a/lib/fstream/compressor.c +++ /dev/null @@ -1,67 +0,0 @@ -/* SPDX-License-Identifier: GPL-3.0-or-later */ -/* - * compressor.c - * - * Copyright (C) 2019 David Oberhollenzer <goliath@infraroot.at> - */ -#include "internal.h" - -int fstream_compressor_id_from_name(const char *name) -{ - if (strcmp(name, "gzip") == 0) - return FSTREAM_COMPRESSOR_GZIP; - - if (strcmp(name, "xz") == 0) - return FSTREAM_COMPRESSOR_XZ; - - if (strcmp(name, "zstd") == 0) - return FSTREAM_COMPRESSOR_ZSTD; - - if (strcmp(name, "bzip2") == 0) - return FSTREAM_COMPRESSOR_BZIP2; - - return -1; -} - -const char *fstream_compressor_name_from_id(int id) -{ - if (id == FSTREAM_COMPRESSOR_GZIP) - return "gzip"; - - if (id == FSTREAM_COMPRESSOR_XZ) - return "xz"; - - if (id == FSTREAM_COMPRESSOR_ZSTD) - return "zstd"; - - if (id == FSTREAM_COMPRESSOR_BZIP2) - return "bzip2"; - - return NULL; -} - -bool fstream_compressor_exists(int id) -{ - switch (id) { -#ifdef WITH_GZIP - case FSTREAM_COMPRESSOR_GZIP: - return true; -#endif -#ifdef WITH_XZ - case FSTREAM_COMPRESSOR_XZ: - return true; -#endif -#if defined(WITH_ZSTD) && defined(HAVE_ZSTD_STREAM) - case FSTREAM_COMPRESSOR_ZSTD: - return true; -#endif -#ifdef WITH_BZIP2 - case FSTREAM_COMPRESSOR_BZIP2: - return true; -#endif - default: - break; - } - - return false; -} |