import
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#ifndef INCLUDED_OS_MEMORY_H
|
||||
#define INCLUDED_OS_MEMORY_H
|
||||
|
||||
#ifndef INCLUDED_OS_TYPES_H
|
||||
#include <os_types.h>
|
||||
#endif /*INCLUDED_OS_TYPES_H*/
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------------------------ */
|
||||
/* */
|
||||
|
||||
void os_memory_init(void* block, os_size_t block_size);
|
||||
|
||||
void* os_memory_alloc(os_size_t nBytes, const char* file, os_size_t line);
|
||||
void* os_memory_realloc(void* ptr, os_size_t nBytes, const char* file, os_size_t line);
|
||||
void* os_memory_calloc(os_size_t nCount, os_size_t nBytes, const char* file, os_size_t line);
|
||||
void os_memory_free(void* ptr, const char* file, os_size_t line);
|
||||
|
||||
#define OS_ALLOC(n) os_memory_alloc((n), __FILE__, __LINE__)
|
||||
#define OS_CALLOC(x, n) os_memory_calloc((x), (n), __FILE__, __LINE__)
|
||||
#define OS_REALLOC(p, n) os_memory_realloc((p), (n), __FILE__, __LINE__)
|
||||
#define OS_FREE(p) ({os_memory_free((p), __FILE__, __LINE__); (p)=NULL;})
|
||||
|
||||
#define OS_RESIZE(p, n) (p) = OS_REALLOC(p, n)
|
||||
#define OS_NEW(p) (p) = OS_ALLOC(sizeof(*(p)))
|
||||
#define OS_NEW0(p) (p) = OS_CALLOC(1, sizeof(*(p)))
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /*INCLUDED_OS_MEMORY_H*/
|
||||
Reference in New Issue
Block a user