NeoMutt  2024-03-23-147-g885fbc
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
zlib.c File Reference

ZLIB compression. More...

#include "config.h"
#include <stddef.h>
#include <zconf.h>
#include <zlib.h>
#include "private.h"
#include "mutt/lib.h"
#include "lib.h"
+ Include dependency graph for zlib.c:

Go to the source code of this file.

Data Structures

struct  ZlibComprData
 Private Zlib Compression Data. More...
 

Macros

#define MIN_COMP_LEVEL   1
 Minimum compression level for zlib.
 
#define MAX_COMP_LEVEL   9
 Maximum compression level for zlib.
 

Functions

void zlib_cdata_free (struct ZlibComprData **ptr)
 Free Zlib Compression Data.
 
static struct ZlibComprDatazlib_cdata_new (void)
 Create new Zlib Compression Data.
 
static ComprHandlecompr_zlib_open (short level)
 Open a compression context - Implements ComprOps::open() -.
 
static void * compr_zlib_compress (ComprHandle *handle, const char *data, size_t dlen, size_t *clen)
 Compress header cache data - Implements ComprOps::compress() -.
 
static void * compr_zlib_decompress (ComprHandle *handle, const char *cbuf, size_t clen)
 Decompress header cache data - Implements ComprOps::decompress() -.
 
static void compr_zlib_close (ComprHandle **ptr)
 Close a compression context - Implements ComprOps::close() -.
 

Detailed Description

ZLIB compression.

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 zlib.c.

Macro Definition Documentation

◆ MIN_COMP_LEVEL

#define MIN_COMP_LEVEL   1

Minimum compression level for zlib.

Definition at line 40 of file zlib.c.

◆ MAX_COMP_LEVEL

#define MAX_COMP_LEVEL   9

Maximum compression level for zlib.

Definition at line 41 of file zlib.c.

Function Documentation

◆ zlib_cdata_free()

void zlib_cdata_free ( struct ZlibComprData **  ptr)

Free Zlib Compression Data.

Parameters
ptrZlib Compression Data to free

Definition at line 56 of file zlib.c.

57{
58 if (!ptr || !*ptr)
59 return;
60
61 struct ZlibComprData *cdata = *ptr;
62 FREE(&cdata->buf);
63
64 FREE(ptr);
65}
#define FREE(x)
Definition: memory.h:45
Private Zlib Compression Data.
Definition: zlib.c:47
void * buf
Temporary buffer.
Definition: zlib.c:48
+ Here is the caller graph for this function:

◆ zlib_cdata_new()

static struct ZlibComprData * zlib_cdata_new ( void  )
static

Create new Zlib Compression Data.

Return values
ptrNew Zlib Compression Data

Definition at line 71 of file zlib.c.

72{
73 return mutt_mem_calloc(1, sizeof(struct ZlibComprData));
74}
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
+ Here is the call graph for this function:
+ Here is the caller graph for this function: