src/ucx/allocator.c

changeset 504
c094afcdfb27
parent 490
d218607f5a7e
equal deleted inserted replaced
503:aeaf7db26fac 504:c094afcdfb27
73 &cx_default_allocator_class, 73 &cx_default_allocator_class,
74 NULL 74 NULL
75 }; 75 };
76 CxAllocator *cxDefaultAllocator = &cx_default_allocator; 76 CxAllocator *cxDefaultAllocator = &cx_default_allocator;
77 77
78
79 int cx_reallocate(
80 void **mem,
81 size_t n
82 ) {
83 void *nmem = realloc(*mem, n);
84 if (nmem == NULL) {
85 return 1;
86 } else {
87 *mem = nmem;
88 return 0;
89 }
90 }
91
78 // IMPLEMENTATION OF HIGH LEVEL API 92 // IMPLEMENTATION OF HIGH LEVEL API
79 93
80 void *cxMalloc( 94 void *cxMalloc(
81 CxAllocator const *allocator, 95 CxAllocator const *allocator,
82 size_t n 96 size_t n

mercurial