diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-06 00:57:13 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-06 00:57:13 +0400 |
commit | ce2e2b141e67e5be8cc85bc394dc6ca9e15f774b (patch) | |
tree | 50508e0df59ab92fce66648e354a337d5de20fce /source/blender/blenlib/BLI_mempool.h | |
parent | b438c2840cbf533830ecb29b1ef65325d3f77f73 (diff) |
use gcc malloc attribute for low level allocation functions, prevents gcc from checking if resulting pointers alias existing pointers, also use sentinel attribute for uiButGetStrInfo so incorrect usage gives a warning.
Diffstat (limited to 'source/blender/blenlib/BLI_mempool.h')
-rw-r--r-- | source/blender/blenlib/BLI_mempool.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index f8775342e94..1c470d59062 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -50,17 +50,20 @@ typedef struct BLI_mempool BLI_mempool; BLI_mempool *BLI_mempool_create(int esize, int totelem, int pchunk, int flag) #ifdef __GNUC__ +__attribute__((malloc)) __attribute__((warn_unused_result)) #endif ; void *BLI_mempool_alloc(BLI_mempool *pool) #ifdef __GNUC__ +__attribute__((malloc)) __attribute__((warn_unused_result)) __attribute__((nonnull(1))) #endif ; void *BLI_mempool_calloc(BLI_mempool *pool) #ifdef __GNUC__ +__attribute__((malloc)) __attribute__((warn_unused_result)) __attribute__((nonnull(1))) #endif @@ -94,6 +97,7 @@ __attribute__((nonnull(1, 2))) void **BLI_mempool_as_tableN(BLI_mempool *pool, const char *allocstr) #ifdef __GNUC__ +__attribute__((malloc)) __attribute__((warn_unused_result)) __attribute__((nonnull(1, 2))) #endif @@ -107,6 +111,7 @@ __attribute__((nonnull(1, 2))) void *BLI_mempool_as_arrayN(BLI_mempool *pool, const char *allocstr) #ifdef __GNUC__ +__attribute__((malloc)) __attribute__((warn_unused_result)) __attribute__((nonnull(1, 2))) #endif |