NeoMutt  2025-01-09-146-g8c4f7e
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
compress.c
Go to the documentation of this file.
1
31#include "config.h"
32#include <stdio.h>
33#include "mutt/lib.h"
34#include "config/lib.h"
35#include "lib.h"
36
40static const struct ComprOps *CompressOps[] = {
41#ifdef HAVE_LZ4
43#endif
44#ifdef HAVE_ZLIB
46#endif
47#ifdef HAVE_ZSTD
49#endif
50 NULL,
51};
52
59struct Slist *compress_list(void)
60{
61 struct Slist *sl = slist_new(D_SLIST_SEP_SPACE);
62
63 const struct ComprOps **compr_ops = CompressOps;
64
65 for (; *compr_ops; compr_ops++)
66 {
67 slist_add_string(sl, (*compr_ops)->name);
68 }
69
70 return sl;
71}
72
78const struct ComprOps *compress_get_ops(const char *compr)
79{
80 const struct ComprOps **compr_ops = CompressOps;
81
82 if (!compr || !*compr)
83 return *compr_ops;
84
85 for (; *compr_ops; compr_ops++)
86 {
87 if (mutt_str_equal(compr, (*compr_ops)->name))
88 break;
89 }
90
91 return *compr_ops;
92}
const struct ComprOps * compress_get_ops(const char *compr)
Get the API functions for a compress backend.
Definition: compress.c:78
static const struct ComprOps * CompressOps[]
Backend implementations.
Definition: compress.c:40
struct Slist * compress_list(void)
Get a list of compression backend names.
Definition: compress.c:59
const struct ComprOps compr_zlib_ops
const struct ComprOps compr_lz4_ops
const struct ComprOps compr_zstd_ops
Convenience wrapper for the config headers.
Convenience wrapper for the library headers.
struct Slist * slist_add_string(struct Slist *list, const char *str)
Add a string to a list.
Definition: slist.c:68
struct Slist * slist_new(uint32_t flags)
Create a new string list.
Definition: slist.c:51
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:661
Key value store.
Definition: lib.h:64
String list.
Definition: slist.h:37
#define D_SLIST_SEP_SPACE
Slist items are space-separated.
Definition: types.h:109