malloc attribute changes
This commit is contained in:
parent
710c6c1be1
commit
373022108b
|
@ -135,6 +135,7 @@ static void ecollect_free ( void ) {
|
||||||
* Calling realloc() with a new size of zero is a valid way to free a
|
* Calling realloc() with a new size of zero is a valid way to free a
|
||||||
* memory block.
|
* memory block.
|
||||||
*/
|
*/
|
||||||
|
__attribute__ ((malloc))
|
||||||
userptr_t urealloc ( userptr_t ptr, size_t new_size ) {
|
userptr_t urealloc ( userptr_t ptr, size_t new_size ) {
|
||||||
struct external_memory extmem;
|
struct external_memory extmem;
|
||||||
userptr_t new = ptr;
|
userptr_t new = ptr;
|
||||||
|
@ -208,6 +209,7 @@ userptr_t urealloc ( userptr_t ptr, size_t new_size ) {
|
||||||
*
|
*
|
||||||
* Memory is guaranteed to be aligned to a page boundary.
|
* Memory is guaranteed to be aligned to a page boundary.
|
||||||
*/
|
*/
|
||||||
|
__attribute__ ((malloc))
|
||||||
userptr_t umalloc ( size_t size ) {
|
userptr_t umalloc ( size_t size ) {
|
||||||
return urealloc ( UNULL, size );
|
return urealloc ( UNULL, size );
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,6 +95,7 @@ static char heap[HEAP_SIZE] __attribute__ (( aligned ( __alignof__(void *) )));
|
||||||
*
|
*
|
||||||
* @c align must be a power of two. @c size may not be zero.
|
* @c align must be a power of two. @c size may not be zero.
|
||||||
*/
|
*/
|
||||||
|
__attribute__ ((malloc))
|
||||||
void * alloc_memblock ( size_t size, size_t align ) {
|
void * alloc_memblock ( size_t size, size_t align ) {
|
||||||
struct memory_block *block;
|
struct memory_block *block;
|
||||||
size_t align_mask;
|
size_t align_mask;
|
||||||
|
@ -248,6 +249,7 @@ void free_memblock ( void *ptr, size_t size ) {
|
||||||
* Calling realloc() with a new size of zero is a valid way to free a
|
* Calling realloc() with a new size of zero is a valid way to free a
|
||||||
* memory block.
|
* memory block.
|
||||||
*/
|
*/
|
||||||
|
__attribute__ ((malloc))
|
||||||
void * realloc ( void *old_ptr, size_t new_size ) {
|
void * realloc ( void *old_ptr, size_t new_size ) {
|
||||||
struct autosized_block *old_block;
|
struct autosized_block *old_block;
|
||||||
struct autosized_block *new_block;
|
struct autosized_block *new_block;
|
||||||
|
@ -297,6 +299,7 @@ void * realloc ( void *old_ptr, size_t new_size ) {
|
||||||
* Allocates memory with no particular alignment requirement. @c ptr
|
* Allocates memory with no particular alignment requirement. @c ptr
|
||||||
* will be aligned to at least a multiple of sizeof(void*).
|
* will be aligned to at least a multiple of sizeof(void*).
|
||||||
*/
|
*/
|
||||||
|
__attribute__ ((malloc))
|
||||||
void * malloc ( size_t size ) {
|
void * malloc ( size_t size ) {
|
||||||
return realloc ( NULL, size );
|
return realloc ( NULL, size );
|
||||||
}
|
}
|
||||||
|
@ -326,6 +329,7 @@ void free ( void *ptr ) {
|
||||||
* This function name is non-standard, but pretty intuitive.
|
* This function name is non-standard, but pretty intuitive.
|
||||||
* zalloc(size) is always equivalent to calloc(1,size)
|
* zalloc(size) is always equivalent to calloc(1,size)
|
||||||
*/
|
*/
|
||||||
|
__attribute__ ((malloc))
|
||||||
void * zalloc ( size_t size ) {
|
void * zalloc ( size_t size ) {
|
||||||
void *data;
|
void *data;
|
||||||
|
|
||||||
|
|
|
@ -31,12 +31,14 @@ typedef void psPool_t;
|
||||||
|
|
||||||
#define sslAssert( ... ) assert ( __VA_ARGS__ )
|
#define sslAssert( ... ) assert ( __VA_ARGS__ )
|
||||||
|
|
||||||
static inline __attribute__ (( always_inline )) void *
|
static inline __attribute__ (( always_inline )) __attribute__ ((malloc))
|
||||||
|
void *
|
||||||
psMalloc ( psPool_t *pool __unused, size_t len ) {
|
psMalloc ( psPool_t *pool __unused, size_t len ) {
|
||||||
return malloc ( len );
|
return malloc ( len );
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline __attribute__ (( always_inline )) void *
|
static inline __attribute__ (( always_inline )) __attribute__ ((malloc))
|
||||||
|
void *
|
||||||
psRealloc ( void *ptr, size_t len ) {
|
psRealloc ( void *ptr, size_t len ) {
|
||||||
return realloc ( ptr, len );
|
return realloc ( ptr, len );
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue