NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
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
 

Functions

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

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

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.

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 80 of file compress.c.

81 {
82  const struct ComprOps **ops = compr_ops;
83 
84  if (!compr || !*compr)
85  return *ops;
86 
87  for (; *ops; ops++)
88  {
89  if (strcmp(compr, (*ops)->name) == 0)
90  break;
91  }
92 
93  return *ops;
94 }
static const struct ComprOps * compr_ops[]
Backend implementations.
Definition: compress.c:38
Definition: lib.h:59
+ 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 57 of file compress.c.

58 {
59  char tmp[256] = { 0 };
60  const struct ComprOps **ops = compr_ops;
61  size_t len = 0;
62 
63  for (; *ops; ops++)
64  {
65  if (len != 0)
66  {
67  len += snprintf(tmp + len, sizeof(tmp) - len, ", ");
68  }
69  len += snprintf(tmp + len, sizeof(tmp) - len, "%s", (*ops)->name);
70  }
71 
72  return mutt_str_dup(tmp);
73 }
char * mutt_str_dup(const char *str)
Copy a string, safely.
Definition: string.c:370
static const struct ComprOps * compr_ops[]
Backend implementations.
Definition: compress.c:38
Definition: lib.h:59
+ 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

◆ compr_zlib_ops

const struct ComprOps compr_zlib_ops

◆ compr_zstd_ops

const struct ComprOps compr_zstd_ops