ReactOS  0.4.15-dev-4857-g47842d7
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.

Functions

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 61 of file zstd_common.c.

62 {
63  /* calloc implemented as malloc+memset;
64  * not as efficient as calloc, but next best guess for custom malloc */
65  void* const ptr = customMem.customAlloc(customMem.opaque, size);
66  memset(ptr, 0, size);
67  return ptr;
68 }
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 70 of file zstd_common.c.

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

Referenced by ZSTD_clearAllDicts(), ZSTD_createCDict_advanced(), ZSTD_cwksp_free(), ZSTD_decompressStream(), ZSTD_freeCCtx(), ZSTD_freeCCtxParams(), ZSTD_freeCDict(), ZSTD_freeDCtx(), ZSTD_freeDDict(), and ZSTD_getSequences().

◆ 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 45 of file zstd_common.c.

45 { 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 41 of file zstd_common.c.

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

Referenced by zstd_compress(), ZSTD_compressSubBlock_literal(), and zstd_decompress().

◆ ZSTD_getErrorString()

const char* ZSTD_getErrorString ( ZSTD_ErrorCode  code)

ZSTD_getErrorString() : provides error code string from enum

Definition at line 49 of file zstd_common.c.

49 { 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 symbol is required for external callers

Definition at line 37 of file zstd_common.c.

37 { 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  )

to check runtime library version

Definition at line 25 of file zstd_common.c.

25 { return ZSTD_VERSION_NUMBER; }
#define ZSTD_VERSION_NUMBER
Definition: zstd.h:77

◆ ZSTD_versionString()

const char* ZSTD_versionString ( void  )

Definition at line 27 of file zstd_common.c.

27 { return ZSTD_VERSION_STRING; }
#define ZSTD_VERSION_STRING
Definition: zstd.h:83