12 #ifndef __WMEM_CORE_H__ 13 #define __WMEM_CORE_H__ 17 #include <ws_symbol_export.h> 18 #include "ws_attributes.h" 81 #define wmem_new(allocator, type) \ 82 ((type*)wmem_alloc((allocator), sizeof(type))) 84 #define wmem_safe_mult(A, B) \ 85 ((((A) <= 0) || ((B) <= 0) || ((gsize)(A) > (G_MAXSSIZE / (gsize)(B)))) ? 0 : ((A) * (B))) 94 #define wmem_alloc_array(allocator, type, num) \ 95 ((type*)wmem_alloc((allocator), wmem_safe_mult(sizeof(type), num))) 116 #define wmem_new0(allocator, type) \ 117 ((type*)wmem_alloc0((allocator), sizeof(type))) 127 #define wmem_alloc0_array(allocator, type, num) \ 128 ((type*)wmem_alloc0((allocator), wmem_safe_mult(sizeof(type), (num)))) WS_DLL_PUBLIC void * wmem_realloc(wmem_allocator_t *allocator, void *ptr, const size_t size) G_GNUC_MALLOC
Definition: wmem_core.c:81
Definition: wmem_core.h:45
Definition: wmem_core.h:57
WS_DLL_PUBLIC void wmem_gc(wmem_allocator_t *allocator)
Definition: wmem_core.c:116
Definition: wmem_allocator.h:26
WS_DLL_PUBLIC void wmem_destroy_allocator(wmem_allocator_t *allocator)
Definition: wmem_core.c:122
Definition: wmem_core.h:53
WS_DLL_PUBLIC void wmem_free_all(wmem_allocator_t *allocator)
Definition: wmem_core.c:110
WS_DLL_PUBLIC void wmem_free(wmem_allocator_t *allocator, void *ptr)
Definition: wmem_core.c:64
WS_DLL_PUBLIC void * wmem_alloc(wmem_allocator_t *allocator, const size_t size) G_GNUC_MALLOC
Definition: wmem_core.c:34
WS_DLL_PUBLIC wmem_allocator_t * wmem_allocator_new(const wmem_allocator_type_t type)
Definition: wmem_core.c:131
_wmem_allocator_type_t
Definition: wmem_core.h:44
WS_DLL_PUBLIC void wmem_cleanup(void)
Definition: wmem_core.c:211
WS_DLL_PUBLIC void wmem_init(void)
Definition: wmem_core.c:173
Definition: wmem_core.h:49
WS_DLL_PUBLIC void * wmem_alloc0(wmem_allocator_t *allocator, const size_t size) G_GNUC_MALLOC
Definition: wmem_core.c:50
enum _wmem_allocator_type_t wmem_allocator_type_t