]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
default custom allocation functions moved to zstd_internal.h
authorinikep <inikep@gmail.com>
Thu, 2 Jun 2016 13:11:39 +0000 (15:11 +0200)
committerinikep <inikep@gmail.com>
Thu, 2 Jun 2016 13:11:39 +0000 (15:11 +0200)
lib/common/zstd_common.c
lib/common/zstd_internal.h
lib/common/zstd_static.h

index c4ec46fb9c7e8ccba98b4b20864ac4c95774d1bf..262eeb232bcebbc96626ef21a426767a415c4bbe 100644 (file)
@@ -76,8 +76,8 @@ const char* ZBUFF_getErrorName(size_t errorCode) { return ERR_getErrorName(error
 
 void* ZSTD_defaultAllocFunction(void* opaque, size_t size)
 {
-    (void)opaque;
     void* address = malloc(size);
+    (void)opaque;
     /* DISPLAYLEVEL(4, "alloc %p, %d opaque=%d \n", address, (int)size, (int)opaque); */
     return address;
 }
index 63e56aaf02d6b4d429036bd18d7b014f80dc8aea..8c647b511497b2e47fb6a1a48444eb5f2fbdaa80 100644 (file)
@@ -255,4 +255,9 @@ const seqStore_t* ZSTD_getSeqStore(const ZSTD_CCtx* ctx);
 void ZSTD_seqToCodes(const seqStore_t* seqStorePtr, size_t const nbSeq);
 int ZSTD_isSkipFrame(ZSTD_DCtx* dctx);
 
+/* custom memory allocation functions */
+void* ZSTD_defaultAllocFunction(void* opaque, size_t size);
+void ZSTD_defaultFreeFunction(void* opaque, void* address);
+MEM_STATIC ZSTD_customMem const defaultCustomMem = { ZSTD_defaultAllocFunction, ZSTD_defaultFreeFunction, NULL };
+
 #endif   /* ZSTD_CCOMMON_H_MODULE */
index b36e92c87bde536c6ddb241f984b8f0d56109143..f452e696287c14b09be2cadb6d2f8ba421cf6471 100644 (file)
@@ -102,10 +102,6 @@ typedef void* (*ZSTD_allocFunction) (void* opaque, size_t size);
 typedef void  (*ZSTD_freeFunction) (void* opaque, void* address);
 typedef struct { ZSTD_allocFunction customAlloc; ZSTD_freeFunction customFree; void* opaque; } ZSTD_customMem;
 
-void* ZSTD_defaultAllocFunction(void* opaque, size_t size);
-void ZSTD_defaultFreeFunction(void* opaque, void* address);
-static ZSTD_customMem const defaultCustomMem = { ZSTD_defaultAllocFunction, ZSTD_defaultFreeFunction, NULL };
-
 
 /*-*************************************
 *  Advanced functions