NeoMutt  2024-11-14-34-g5aaf0d
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 "lib.h"
35
39static const struct ComprOps *CompressOps[] = {
40#ifdef HAVE_LZ4
42#endif
43#ifdef HAVE_ZLIB
45#endif
46#ifdef HAVE_ZSTD
48#endif
49 NULL,
50};
51
58const char *compress_list(void)
59{
60 char tmp[256] = { 0 };
61 const struct ComprOps **compr_ops = CompressOps;
62 size_t len = 0;
63
64 for (; *compr_ops; compr_ops++)
65 {
66 if (len != 0)
67 {
68 len += snprintf(tmp + len, sizeof(tmp) - len, ", ");
69 }
70 len += snprintf(tmp + len, sizeof(tmp) - len, "%s", (*compr_ops)->name);
71 }
72
73 return mutt_str_dup(tmp);
74}
75
81const struct ComprOps *compress_get_ops(const char *compr)
82{
83 const struct ComprOps **compr_ops = CompressOps;
84
85 if (!compr || !*compr)
86 return *compr_ops;
87
88 for (; *compr_ops; compr_ops++)
89 {
90 if (mutt_str_equal(compr, (*compr_ops)->name))
91 break;
92 }
93
94 return *compr_ops;
95}
const char * compress_list(void)
Get a list of compression backend names.
Definition: compress.c:58
const struct ComprOps * compress_get_ops(const char *compr)
Get the API functions for a compress backend.
Definition: compress.c:81
static const struct ComprOps * CompressOps[]
Backend implementations.
Definition: compress.c:39
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:253
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:660
Key value store.
Definition: lib.h:64