NeoMutt  2024-12-12-19-ge4b57e
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
lib.h File Reference

API for the header cache compression. More...

#include <stdlib.h>
+ Include dependency graph for lib.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ComprOps
 

Typedefs

typedef void ComprHandle
 Opaque type for compression data.
 

Functions

const struct ComprOpscompress_get_ops (const char *compr)
 Get the API functions for a compress backend.
 
const char * compress_list (void)
 Get a list of compression backend names.
 

Variables

const struct ComprOps compr_lz4_ops
 
const struct ComprOps compr_zlib_ops
 
const struct ComprOps compr_zstd_ops
 

Detailed Description

API for the header cache compression.

Authors
  • Tino Reichardt
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file lib.h.

Typedef Documentation

◆ ComprHandle

typedef void ComprHandle

Opaque type for compression data.

Definition at line 56 of file lib.h.

Function Documentation

◆ compress_get_ops()

const struct ComprOps * compress_get_ops ( const char *  compr)

Get the API functions for a compress backend.

Parameters
comprName of the backend
Return values
ptrSet of function pointers

Definition at line 81 of file compress.c.

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}
static const struct ComprOps * CompressOps[]
Backend implementations.
Definition: compress.c:39
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:660
Definition: lib.h:64
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ compress_list()

const char * compress_list ( void  )

Get a list of compression backend names.

Return values
ptrComma-space-separated list of names
Note
The caller should free the string

Definition at line 58 of file compress.c.

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}
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:253
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ compr_lz4_ops

const struct ComprOps compr_lz4_ops
extern

◆ compr_zlib_ops

const struct ComprOps compr_zlib_ops
extern

◆ compr_zstd_ops

const struct ComprOps compr_zstd_ops
extern