Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-14 16:47:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-14 16:47:49 +0400
commit98520ce4deccb24e5992930694bb4189f6fce0f3 (patch)
treef568145afab15183e27ddbc0b37b19ed5ffcc758 /intern/guardedalloc
parentac8c56c6fc9e1a816160144b5cebe2e99ffa67fc (diff)
use gcc attributes for BLI alloc functions
Diffstat (limited to 'intern/guardedalloc')
-rw-r--r--intern/guardedalloc/MEM_guardedalloc.h25
-rw-r--r--intern/guardedalloc/intern/mallocn.c4
2 files changed, 14 insertions, 15 deletions
diff --git a/intern/guardedalloc/MEM_guardedalloc.h b/intern/guardedalloc/MEM_guardedalloc.h
index 7fcfba5afec..dfb3fe69474 100644
--- a/intern/guardedalloc/MEM_guardedalloc.h
+++ b/intern/guardedalloc/MEM_guardedalloc.h
@@ -60,8 +60,8 @@
#ifndef __MEM_GUARDEDALLOC_H__
#define __MEM_GUARDEDALLOC_H__
-#include <stdio.h> /* needed for FILE* */
-#include "MEM_sys_types.h" /* needed for uintptr_t */
+#include <stdio.h> /* needed for FILE* */
+#include "MEM_sys_types.h" /* needed for uintptr_t */
#ifdef __cplusplus
extern "C" {
@@ -70,7 +70,7 @@ extern "C" {
/** Returns the length of the allocated memory segment pointed at
* by vmemh. If the pointer was not previously allocated by this
* module, the result is undefined.*/
- size_t MEM_allocN_len(void *vmemh)
+ size_t MEM_allocN_len(const void *vmemh)
#ifdef __GNUC__
__attribute__((warn_unused_result))
#endif
@@ -111,10 +111,10 @@ extern "C" {
* Allocate a block of memory of size len, with tag name str. The
* memory is cleared. The name must be static, because only a
* pointer to it is stored ! */
- void *MEM_callocN(size_t len, const char * str)
+ void *MEM_callocN(size_t len, const char *str)
#ifdef __GNUC__
__attribute__((warn_unused_result))
- __attribute__((nonnull))
+ __attribute__((nonnull(2)))
__attribute__((alloc_size(1)))
#endif
;
@@ -122,10 +122,10 @@ extern "C" {
/** Allocate a block of memory of size len, with tag name str. The
* name must be a static, because only a pointer to it is stored !
* */
- void *MEM_mallocN(size_t len, const char * str)
+ void *MEM_mallocN(size_t len, const char *str)
#ifdef __GNUC__
__attribute__((warn_unused_result))
- __attribute__((nonnull))
+ __attribute__((nonnull(2)))
__attribute__((alloc_size(1)))
#endif
;
@@ -133,10 +133,10 @@ extern "C" {
/** Same as callocN, clears memory and uses mmap (disk cached) if supported.
* Can be free'd with MEM_freeN as usual.
* */
- void *MEM_mapallocN(size_t len, const char * str)
+ void *MEM_mapallocN(size_t len, const char *str)
#ifdef __GNUC__
__attribute__((warn_unused_result))
- __attribute__((nonnull))
+ __attribute__((nonnull(2)))
__attribute__((alloc_size(1)))
#endif
;
@@ -213,11 +213,10 @@ public: \
MEM_freeN(mem); \
} \
-#endif
-
+#endif /* __cplusplus */
#ifdef __cplusplus
}
-#endif
+#endif /* __cplusplus */
-#endif
+#endif /* __MEM_GUARDEDALLOC_H__ */
diff --git a/intern/guardedalloc/intern/mallocn.c b/intern/guardedalloc/intern/mallocn.c
index 9ba8c0f3d58..7eda5a3ab5e 100644
--- a/intern/guardedalloc/intern/mallocn.c
+++ b/intern/guardedalloc/intern/mallocn.c
@@ -222,10 +222,10 @@ void MEM_set_memory_debug(void)
malloc_debug_memset = 1;
}
-size_t MEM_allocN_len(void *vmemh)
+size_t MEM_allocN_len(const void *vmemh)
{
if (vmemh) {
- MemHead *memh = vmemh;
+ const MemHead *memh = vmemh;
memh--;
return memh->len;