src/allocator.c

changeset 890
54565fd74e74
parent 726
44986c0e2b05
equal deleted inserted replaced
889:f549fd9fbd8f 890:54565fd74e74
90 } 90 }
91 91
92 // IMPLEMENTATION OF HIGH LEVEL API 92 // IMPLEMENTATION OF HIGH LEVEL API
93 93
94 void *cxMalloc( 94 void *cxMalloc(
95 CxAllocator const *allocator, 95 const CxAllocator *allocator,
96 size_t n 96 size_t n
97 ) { 97 ) {
98 return allocator->cl->malloc(allocator->data, n); 98 return allocator->cl->malloc(allocator->data, n);
99 } 99 }
100 100
101 void *cxRealloc( 101 void *cxRealloc(
102 CxAllocator const *allocator, 102 const CxAllocator *allocator,
103 void *mem, 103 void *mem,
104 size_t n 104 size_t n
105 ) { 105 ) {
106 return allocator->cl->realloc(allocator->data, mem, n); 106 return allocator->cl->realloc(allocator->data, mem, n);
107 } 107 }
108 108
109 int cxReallocate( 109 int cxReallocate(
110 CxAllocator const *allocator, 110 const CxAllocator *allocator,
111 void **mem, 111 void **mem,
112 size_t n 112 size_t n
113 ) { 113 ) {
114 void *nmem = allocator->cl->realloc(allocator->data, *mem, n); 114 void *nmem = allocator->cl->realloc(allocator->data, *mem, n);
115 if (nmem == NULL) { 115 if (nmem == NULL) {
119 return 0; 119 return 0;
120 } 120 }
121 } 121 }
122 122
123 void *cxCalloc( 123 void *cxCalloc(
124 CxAllocator const *allocator, 124 const CxAllocator *allocator,
125 size_t nelem, 125 size_t nelem,
126 size_t n 126 size_t n
127 ) { 127 ) {
128 return allocator->cl->calloc(allocator->data, nelem, n); 128 return allocator->cl->calloc(allocator->data, nelem, n);
129 } 129 }
130 130
131 void cxFree( 131 void cxFree(
132 CxAllocator const *allocator, 132 const CxAllocator *allocator,
133 void *mem 133 void *mem
134 ) { 134 ) {
135 allocator->cl->free(allocator->data, mem); 135 allocator->cl->free(allocator->data, mem);
136 } 136 }

mercurial