diff options
author | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2023-06-21 00:00:00 +0000 |
---|---|---|
committer | Igor Pavlov <87184205+ip7z@users.noreply.github.com> | 2023-12-17 14:59:19 +0500 |
commit | 5b39dc76f1bc82f941d5c800ab9f34407a06b53a (patch) | |
tree | fe5e17420300b715021a76328444088d32047963 /C/Alloc.h | |
parent | 93be7d4abfd4233228f58ee1fbbcd76d91be66a4 (diff) | |
download | 7zip-5b39dc76f1bc82f941d5c800ab9f34407a06b53a.tar.gz 7zip-5b39dc76f1bc82f941d5c800ab9f34407a06b53a.tar.bz2 7zip-5b39dc76f1bc82f941d5c800ab9f34407a06b53a.zip |
23.0123.01
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); |