diff options
Diffstat (limited to 'C/Alloc.h')
-rw-r--r-- | C/Alloc.h | 19 |
1 files changed, 16 insertions, 3 deletions
@@ -1,19 +1,32 @@ | |||
1 | /* Alloc.h -- Memory allocation functions | 1 | /* Alloc.h -- Memory allocation functions |
2 | 2021-07-13 : Igor Pavlov : Public domain */ | 2 | 2023-03-04 : Igor Pavlov : Public domain */ |
3 | 3 | ||
4 | #ifndef __COMMON_ALLOC_H | 4 | #ifndef ZIP7_INC_ALLOC_H |
5 | #define __COMMON_ALLOC_H | 5 | #define ZIP7_INC_ALLOC_H |
6 | 6 | ||
7 | #include "7zTypes.h" | 7 | #include "7zTypes.h" |
8 | 8 | ||
9 | EXTERN_C_BEGIN | 9 | EXTERN_C_BEGIN |
10 | 10 | ||
11 | /* | ||
12 | MyFree(NULL) : is allowed, as free(NULL) | ||
13 | MyAlloc(0) : returns NULL : but malloc(0) is allowed to return NULL or non_NULL | ||
14 | MyRealloc(NULL, 0) : returns NULL : but realloc(NULL, 0) is allowed to return NULL or non_NULL | ||
15 | MyRealloc() is similar to realloc() for the following cases: | ||
16 | MyRealloc(non_NULL, 0) : returns NULL and always calls MyFree(ptr) | ||
17 | MyRealloc(NULL, non_ZERO) : returns NULL, if allocation failed | ||
18 | MyRealloc(non_NULL, non_ZERO) : returns NULL, if reallocation failed | ||
19 | */ | ||
20 | |||
11 | void *MyAlloc(size_t size); | 21 | void *MyAlloc(size_t size); |
12 | void MyFree(void *address); | 22 | void MyFree(void *address); |
23 | void *MyRealloc(void *address, size_t size); | ||
13 | 24 | ||
14 | #ifdef _WIN32 | 25 | #ifdef _WIN32 |
15 | 26 | ||
27 | #ifdef Z7_LARGE_PAGES | ||
16 | void SetLargePageSize(void); | 28 | void SetLargePageSize(void); |
29 | #endif | ||
17 | 30 | ||
18 | void *MidAlloc(size_t size); | 31 | void *MidAlloc(size_t size); |
19 | void MidFree(void *address); | 32 | void MidFree(void *address); |