NeoMutt
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
compress.c
Go to the documentation of this file.
1
29#include "config.h"
30#include <stdio.h>
31#include "mutt/lib.h"
32#include "lib.h"
33
37static const struct ComprOps *CompressOps[] = {
38#ifdef HAVE_LZ4
40#endif
41#ifdef HAVE_ZLIB
43#endif
44#ifdef HAVE_ZSTD
46#endif
47 NULL,
48};
49
56const char *compress_list(void)
57{
58 char tmp[256] = { 0 };
59 const struct ComprOps **compr_ops = CompressOps;
60 size_t len = 0;
61
62 for (; *compr_ops; compr_ops++)
63 {
64 if (len != 0)
65 {
66 len += snprintf(tmp + len, sizeof(tmp) - len, ", ");
67 }
68 len += snprintf(tmp + len, sizeof(tmp) - len, "%s", (*compr_ops)->name);
69 }
70
71 return mutt_str_dup(tmp);
72}
73
79const struct ComprOps *compress_get_ops(const char *compr)
80{
81 const struct ComprOps **compr_ops = CompressOps;
82
83 if (!compr || !*compr)
84 return *compr_ops;
85
86 for (; *compr_ops; compr_ops++)
87 {
88 if (mutt_str_equal(compr, (*compr_ops)->name))
89 break;
90 }
91
92 return *compr_ops;
93}
const char * compress_list(void)
Get a list of compression backend names.
Definition: compress.c:56
const struct ComprOps * compress_get_ops(const char *compr)
Get the API functions for a compress backend.
Definition: compress.c:79
static const struct ComprOps * CompressOps[]
Backend implementations.
Definition: compress.c:37
const struct ComprOps compr_zlib_ops
const struct ComprOps compr_lz4_ops
const struct ComprOps compr_zstd_ops
Convenience wrapper for the library headers.
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:251
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:798
Key value store.
Definition: lib.h:63