src/allocator.c

changeset 726
44986c0e2b05
parent 650
77021e06b1a8
child 890
54565fd74e74
equal deleted inserted replaced
725:c9b882bef838 726:44986c0e2b05
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