NeoMutt  2025-01-09-144-gb44c67
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
compress.c File Reference

Shared compression code. More...

#include "config.h"
#include <stdio.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "lib.h"
+ Include dependency graph for compress.c:

Go to the source code of this file.

Functions

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

Variables

static const struct ComprOpsCompressOps []
 Backend implementations.
 

Detailed Description

Shared compression code.

Authors
  • Tino Reichardt
  • Pietro Cerutti
  • 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 compress.c.

Function Documentation

◆ compress_list()

struct Slist * compress_list ( void  )

Get a list of compression backend names.

Return values
ptrList of names
Note
Caller should free the Slist

Definition at line 59 of file compress.c.

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}
static const struct ComprOps * CompressOps[]
Backend implementations.
Definition: compress.c:40
struct Slist * slist_add_string(struct Slist *list, const char *str)
Add a string to a list.
Definition: slist.c:68
struct Slist * slist_new(uint32_t flags)
Create a new string list.
Definition: slist.c:51
Definition: lib.h:64
String list.
Definition: slist.h:37
#define D_SLIST_SEP_SPACE
Slist items are space-separated.
Definition: types.h:109
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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

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}
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:661
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ CompressOps

const struct ComprOps* CompressOps[]
static
Initial value:
= {
NULL,
}
const struct ComprOps compr_zlib_ops
const struct ComprOps compr_lz4_ops
const struct ComprOps compr_zstd_ops

Backend implementations.

Definition at line 40 of file compress.c.