NeoMutt
2025-12-11-1039-g550ac6
Teaching an old dog new tricks
DOXYGEN
Toggle main menu visibility
Loading...
Searching...
No Matches
compress.c
Go to the documentation of this file.
1
24
30
31
#include "config.h"
32
#include <stdio.h>
33
#include "
mutt/lib.h
"
34
#include "
config/lib.h
"
35
#include "
lib.h
"
36
40
static
const
struct
ComprOps
*
CompressOps
[] = {
41
#ifdef HAVE_LZ4
42
&
compr_lz4_ops
,
43
#endif
44
#ifdef HAVE_ZLIB
45
&
compr_zlib_ops
,
46
#endif
47
#ifdef HAVE_ZSTD
48
&
compr_zstd_ops
,
49
#endif
50
NULL,
51
};
52
59
struct
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
78
const
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
}
compress_get_ops
const struct ComprOps * compress_get_ops(const char *compr)
Get the API functions for a compress backend.
Definition
compress.c:78
CompressOps
static const struct ComprOps * CompressOps[]
Backend implementations.
Definition
compress.c:40
compress_list
struct Slist * compress_list(void)
Get a list of compression backend names.
Definition
compress.c:59
lib.h
API for the header cache compression.
compr_zlib_ops
const struct ComprOps compr_zlib_ops
compr_lz4_ops
const struct ComprOps compr_lz4_ops
compr_zstd_ops
const struct ComprOps compr_zstd_ops
lib.h
Convenience wrapper for the config headers.
lib.h
Convenience wrapper for the library headers.
slist_add_string
struct Slist * slist_add_string(struct Slist *list, const char *str)
Add a string to a list.
Definition
slist.c:68
slist_new
struct Slist * slist_new(uint32_t flags)
Create a new string list.
Definition
slist.c:51
mutt_str_equal
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition
string.c:666
ComprOps
Definition
lib.h:65
Slist
String list.
Definition
slist.h:37
D_SLIST_SEP_SPACE
#define D_SLIST_SEP_SPACE
Slist items are space-separated.
Definition
types.h:110