ReactOS  0.4.15-dev-3440-g915569a
zstd_common.c File Reference
#include <stdlib.h>
#include <string.h>
#include "error_private.h"
#include "zstd_internal.h"
Include dependency graph for zstd_common.c:

Go to the source code of this file.


unsigned ZSTD_versionNumber (void)
const charZSTD_versionString (void)
unsigned ZSTD_isError (size_t code)
const charZSTD_getErrorName (size_t code)
ZSTD_ErrorCode ZSTD_getErrorCode (size_t code)
const charZSTD_getErrorString (ZSTD_ErrorCode code)
voidZSTD_malloc (size_t size, ZSTD_customMem customMem)
voidZSTD_calloc (size_t size, ZSTD_customMem customMem)
void ZSTD_free (void *ptr, ZSTD_customMem customMem)

Function Documentation

◆ ZSTD_calloc()

void* ZSTD_calloc ( size_t  size,
ZSTD_customMem  customMem 

Definition at line 59 of file zstd_common.c.

60 {
61  /* calloc implemented as malloc+memset;
62  * not as efficient as calloc, but next best guess for custom malloc */
63  void* const ptr = customMem.customAlloc(customMem.opaque, size);
64  memset(ptr, 0, size);
65  return ptr;
66 }
static PVOID ptr
Definition: dispmode.c:27
GLsizeiptr size
Definition: glext.h:5919
#define memset(x, y, z)
Definition: compat.h:39

Referenced by ZSTD_createCCtxParams_advanced().

◆ ZSTD_free()

void ZSTD_free ( void ptr,
ZSTD_customMem  customMem 

Definition at line 68 of file zstd_common.c.

69 {
70  if (ptr!=NULL)
71  customMem.customFree(customMem.opaque, ptr);
72 }
static PVOID ptr
Definition: dispmode.c:27
#define NULL
Definition: types.h:112

Referenced by ZSTD_createCDict_advanced(), ZSTD_decompressStream(), ZSTD_freeCCtx(), ZSTD_freeCCtxContent(), ZSTD_freeCCtxParams(), ZSTD_freeCDict(), ZSTD_freeDCtx(), ZSTD_freeDDict(), and ZSTD_resetCCtx_internal().

◆ ZSTD_getErrorCode()

ZSTD_ErrorCode ZSTD_getErrorCode ( size_t  code)

ZSTD_getError() : convert a size_t function result into a proper ZSTD_errorCode enum

Definition at line 43 of file zstd_common.c.

43 { return ERR_getErrorCode(code); }
ERR_STATIC ERR_enum ERR_getErrorCode(size_t code)
Definition: error_private.h:58
Definition: inflate.c:139

Referenced by ZSTD_decompressMultiFrame().

◆ ZSTD_getErrorName()

const char* ZSTD_getErrorName ( size_t  code)

ZSTD_getErrorName() : provides error code string from function result (useful for debugging)

Definition at line 39 of file zstd_common.c.

39 { return ERR_getErrorName(code); }
ERR_STATIC const char * ERR_getErrorName(size_t code)
Definition: error_private.h:67
Definition: inflate.c:139

Referenced by zstd_compress(), and zstd_decompress().

◆ ZSTD_getErrorString()

const char* ZSTD_getErrorString ( ZSTD_ErrorCode  code)

ZSTD_getErrorString() : provides error code string from enum

Definition at line 47 of file zstd_common.c.

47 { return ERR_getErrorString(code); }
Definition: inflate.c:139
const char * ERR_getErrorString(ERR_enum code)
Definition: error_private.c:15

◆ ZSTD_isError()

unsigned ZSTD_isError ( size_t  code)

ZSTD_isError() : tells if a return value is an error code

Definition at line 35 of file zstd_common.c.

35 { return ERR_isError(code); }
ERR_STATIC unsigned ERR_isError(size_t code)
Definition: error_private.h:56
Definition: inflate.c:139

◆ ZSTD_malloc()

void* ZSTD_malloc ( size_t  size,
ZSTD_customMem  customMem 

◆ ZSTD_versionNumber()

unsigned ZSTD_versionNumber ( void  )

useful to check dll version

Definition at line 25 of file zstd_common.c.

25 { return ZSTD_VERSION_NUMBER; }
Definition: zstd.h:76

◆ ZSTD_versionString()

const char* ZSTD_versionString ( void  )

Definition at line 27 of file zstd_common.c.

27 { return ZSTD_VERSION_STRING; }
Definition: zstd.h:82