MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ZSTD_initStaticDDict

Function ZSTD_initStaticDDict

freebsd/contrib/openzfs/module/zstd/lib/zstd.c:24387–24409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

24385
24386
24387const ZSTD_DDict* ZSTD_initStaticDDict(
24388 void* sBuffer, size_t sBufferSize,
24389 const void* dict, size_t dictSize,
24390 ZSTD_dictLoadMethod_e dictLoadMethod,
24391 ZSTD_dictContentType_e dictContentType)
24392{
24393 size_t const neededSpace = sizeof(ZSTD_DDict)
24394 + (dictLoadMethod == ZSTD_dlm_byRef ? 0 : dictSize);
24395 ZSTD_DDict* const ddict = (ZSTD_DDict*)sBuffer;
24396 assert(sBuffer != NULL);
24397 assert(dict != NULL);
24398 if ((size_t)sBuffer & 7) return NULL; /* 8-aligned */
24399 if (sBufferSize < neededSpace) return NULL;
24400 if (dictLoadMethod == ZSTD_dlm_byCopy) {
24401 memcpy(ddict+1, dict, dictSize); /* local copy */
24402 dict = ddict+1;
24403 }
24404 if (ZSTD_isError( ZSTD_initDDict_internal(ddict,
24405 dict, dictSize,
24406 ZSTD_dlm_byRef, dictContentType) ))
24407 return NULL;
24408 return ddict;
24409}
24410
24411
24412size_t ZSTD_freeDDict(ZSTD_DDict* ddict)

Callers

nothing calls this directly

Calls 3

ZSTD_isErrorFunction · 0.70
ZSTD_initDDict_internalFunction · 0.70
memcpyFunction · 0.50

Tested by

no test coverage detected