1133:0aecb9fda851 | 1134:60edcd57d54c |
---|---|
71 &cx_default_allocator_class, | 71 &cx_default_allocator_class, |
72 NULL | 72 NULL |
73 }; | 73 }; |
74 CxAllocator *cxDefaultAllocator = &cx_default_allocator; | 74 CxAllocator *cxDefaultAllocator = &cx_default_allocator; |
75 | 75 |
76 #undef cx_reallocate | 76 int cx_reallocate_( |
77 int cx_reallocate( | |
78 void **mem, | 77 void **mem, |
79 size_t n | 78 size_t n |
80 ) { | 79 ) { |
81 void *nmem = realloc(*mem, n); | 80 void *nmem = realloc(*mem, n); |
82 if (nmem == NULL) { | 81 if (nmem == NULL) { |
85 *mem = nmem; | 84 *mem = nmem; |
86 return 0; | 85 return 0; |
87 } | 86 } |
88 } | 87 } |
89 | 88 |
90 #undef cx_reallocatearray | 89 int cx_reallocatearray_( |
91 int cx_reallocatearray( | |
92 void **mem, | 90 void **mem, |
93 size_t nmemb, | 91 size_t nmemb, |
94 size_t size | 92 size_t size |
95 ) { | 93 ) { |
96 size_t n; | 94 size_t n; |
138 } else { | 136 } else { |
139 return allocator->cl->realloc(allocator->data, mem, n); | 137 return allocator->cl->realloc(allocator->data, mem, n); |
140 } | 138 } |
141 } | 139 } |
142 | 140 |
143 #undef cxReallocate | 141 int cxReallocate_( |
144 int cxReallocate( | |
145 const CxAllocator *allocator, | 142 const CxAllocator *allocator, |
146 void **mem, | 143 void **mem, |
147 size_t n | 144 size_t n |
148 ) { | 145 ) { |
149 void *nmem = allocator->cl->realloc(allocator->data, *mem, n); | 146 void *nmem = allocator->cl->realloc(allocator->data, *mem, n); |
153 *mem = nmem; | 150 *mem = nmem; |
154 return 0; | 151 return 0; |
155 } | 152 } |
156 } | 153 } |
157 | 154 |
158 #undef cxReallocateArray | 155 int cxReallocateArray_( |
159 int cxReallocateArray( | |
160 const CxAllocator *allocator, | 156 const CxAllocator *allocator, |
161 void **mem, | 157 void **mem, |
162 size_t nmemb, | 158 size_t nmemb, |
163 size_t size | 159 size_t size |
164 ) { | 160 ) { |