Fixing some left out custom allocation calls
This commit is contained in:
1 parent
87916ab71b
commit
8498b97f4c
5 files changed
+1018
-1014
No files matched your search
+986
-981
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -1091,7 +1091,7 @@ struct cmc_callbacks_multiset
|
||||
\
|
||||
struct SNAME##_iter *PFX##_iter_new(struct SNAME *target) \
|
||||
{ \
|
||||
struct SNAME##_iter *iter = malloc(sizeof(struct SNAME##_iter)); \
|
||||
struct SNAME##_iter *iter = target->alloc->malloc(sizeof(struct SNAME##_iter)); \
|
||||
\
|
||||
if (!iter) \
|
||||
return NULL; \
|
||||
|
||||
+2
-3
@@ -297,14 +297,13 @@ struct cmc_callbacks_stack
|
||||
\
|
||||
void PFX##_free(struct SNAME *_stack_, void (*deallocator)(V)) \
|
||||
{ \
|
||||
_stack_->alloc->free(_stack_->buffer); \
|
||||
\
|
||||
if (deallocator) \
|
||||
{ \
|
||||
for (size_t i = 0; i < _stack_->count; i++) \
|
||||
deallocator(_stack_->buffer[i]); \
|
||||
} \
|
||||
\
|
||||
\
|
||||
_stack_->alloc->free(_stack_->buffer); \
|
||||
_stack_->alloc->free(_stack_); \
|
||||
} \
|
||||
\
|
||||
|
||||
+15
-15
@@ -236,7 +236,7 @@ struct cmc_callbacks_treemap
|
||||
#define CMC_GENERATE_TREEMAP_SOURCE(PFX, SNAME, K, V) \
|
||||
\
|
||||
/* Implementation Detail Functions */ \
|
||||
static struct SNAME##_node *PFX##_impl_new_node(K key, V value); \
|
||||
static struct SNAME##_node *PFX##_impl_new_node(struct SNAME *_map_, K key, V value); \
|
||||
static struct SNAME##_node *PFX##_impl_get_node(struct SNAME *_map_, \
|
||||
K key); \
|
||||
static unsigned char PFX##_impl_h(struct SNAME##_node *node); \
|
||||
@@ -326,7 +326,7 @@ struct cmc_callbacks_treemap
|
||||
if (deallocator) \
|
||||
deallocator(scan->key, scan->value); \
|
||||
\
|
||||
free(scan); \
|
||||
_map_->alloc->free(scan); \
|
||||
scan = NULL; \
|
||||
} \
|
||||
\
|
||||
@@ -335,7 +335,7 @@ struct cmc_callbacks_treemap
|
||||
if (deallocator) \
|
||||
deallocator(scan->key, scan->value); \
|
||||
\
|
||||
free(scan); \
|
||||
_map_->alloc->free(scan); \
|
||||
\
|
||||
if (up->right != NULL) \
|
||||
{ \
|
||||
@@ -360,14 +360,14 @@ struct cmc_callbacks_treemap
|
||||
{ \
|
||||
PFX##_clear(_map_, deallocator); \
|
||||
\
|
||||
free(_map_); \
|
||||
_map_->alloc->free(_map_); \
|
||||
} \
|
||||
\
|
||||
bool PFX##_insert(struct SNAME *_map_, K key, V value) \
|
||||
{ \
|
||||
if (PFX##_empty(_map_)) \
|
||||
{ \
|
||||
_map_->root = PFX##_impl_new_node(key, value); \
|
||||
_map_->root = PFX##_impl_new_node(_map_, key, value); \
|
||||
\
|
||||
if (!_map_->root) \
|
||||
return false; \
|
||||
@@ -393,7 +393,7 @@ struct cmc_callbacks_treemap
|
||||
\
|
||||
if (_map_->cmp(parent->key, key) > 0) \
|
||||
{ \
|
||||
parent->left = PFX##_impl_new_node(key, value); \
|
||||
parent->left = PFX##_impl_new_node(_map_, key, value); \
|
||||
\
|
||||
if (!parent->left) \
|
||||
return false; \
|
||||
@@ -403,7 +403,7 @@ struct cmc_callbacks_treemap
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
parent->right = PFX##_impl_new_node(key, value); \
|
||||
parent->right = PFX##_impl_new_node(_map_, key, value); \
|
||||
\
|
||||
if (!parent->right) \
|
||||
return false; \
|
||||
@@ -463,7 +463,7 @@ struct cmc_callbacks_treemap
|
||||
node->parent->left = NULL; \
|
||||
} \
|
||||
\
|
||||
free(node); \
|
||||
_map_->alloc->free(node); \
|
||||
} \
|
||||
else if (node->left == NULL) \
|
||||
{ \
|
||||
@@ -484,7 +484,7 @@ struct cmc_callbacks_treemap
|
||||
node->parent->left = node->right; \
|
||||
} \
|
||||
\
|
||||
free(node); \
|
||||
_map_->alloc->free(node); \
|
||||
} \
|
||||
else if (node->right == NULL) \
|
||||
{ \
|
||||
@@ -505,7 +505,7 @@ struct cmc_callbacks_treemap
|
||||
node->parent->left = node->left; \
|
||||
} \
|
||||
\
|
||||
free(node); \
|
||||
_map_->alloc->free(node); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
@@ -544,7 +544,7 @@ struct cmc_callbacks_treemap
|
||||
temp->parent->left = temp->left; \
|
||||
} \
|
||||
\
|
||||
free(temp); \
|
||||
_map_->alloc->free(temp); \
|
||||
\
|
||||
node->key = temp_key; \
|
||||
node->value = temp_val; \
|
||||
@@ -719,7 +719,7 @@ struct cmc_callbacks_treemap
|
||||
\
|
||||
struct SNAME##_iter *PFX##_iter_new(struct SNAME *target) \
|
||||
{ \
|
||||
struct SNAME##_iter *iter = malloc(sizeof(struct SNAME##_iter)); \
|
||||
struct SNAME##_iter *iter = target->alloc->malloc(sizeof(struct SNAME##_iter)); \
|
||||
\
|
||||
if (!iter) \
|
||||
return NULL; \
|
||||
@@ -731,7 +731,7 @@ struct cmc_callbacks_treemap
|
||||
\
|
||||
void PFX##_iter_free(struct SNAME##_iter *iter) \
|
||||
{ \
|
||||
free(iter); \
|
||||
iter->target->alloc->free(iter); \
|
||||
} \
|
||||
\
|
||||
void PFX##_iter_init(struct SNAME##_iter *iter, struct SNAME *target) \
|
||||
@@ -959,9 +959,9 @@ struct cmc_callbacks_treemap
|
||||
return iter->index; \
|
||||
} \
|
||||
\
|
||||
static struct SNAME##_node *PFX##_impl_new_node(K key, V value) \
|
||||
static struct SNAME##_node *PFX##_impl_new_node(struct SNAME *_map_, K key, V value) \
|
||||
{ \
|
||||
struct SNAME##_node *node = malloc(sizeof(struct SNAME##_node)); \
|
||||
struct SNAME##_node *node = _map_->alloc->malloc(sizeof(struct SNAME##_node)); \
|
||||
\
|
||||
if (!node) \
|
||||
return NULL; \
|
||||
|
||||
+14
-14
@@ -250,7 +250,7 @@ struct cmc_callbacks_treeset
|
||||
#define CMC_GENERATE_TREESET_SOURCE(PFX, SNAME, V) \
|
||||
\
|
||||
/* Implementation Detail Functions */ \
|
||||
static struct SNAME##_node *PFX##_impl_new_node(V element); \
|
||||
static struct SNAME##_node *PFX##_impl_new_node(struct SNAME *_set_, V element); \
|
||||
static struct SNAME##_node *PFX##_impl_get_node(struct SNAME *_set_, \
|
||||
V element); \
|
||||
static unsigned char PFX##_impl_h(struct SNAME##_node *node); \
|
||||
@@ -340,7 +340,7 @@ struct cmc_callbacks_treeset
|
||||
if (deallocator) \
|
||||
deallocator(scan->value); \
|
||||
\
|
||||
free(scan); \
|
||||
_set_->alloc->free(scan); \
|
||||
scan = NULL; \
|
||||
} \
|
||||
\
|
||||
@@ -349,7 +349,7 @@ struct cmc_callbacks_treeset
|
||||
if (deallocator) \
|
||||
deallocator(scan->value); \
|
||||
\
|
||||
free(scan); \
|
||||
_set_->alloc->free(scan); \
|
||||
\
|
||||
if (up->right != NULL) \
|
||||
{ \
|
||||
@@ -374,14 +374,14 @@ struct cmc_callbacks_treeset
|
||||
{ \
|
||||
PFX##_clear(_set_, deallocator); \
|
||||
\
|
||||
free(_set_); \
|
||||
_set_->alloc->free(_set_); \
|
||||
} \
|
||||
\
|
||||
bool PFX##_insert(struct SNAME *_set_, V element) \
|
||||
{ \
|
||||
if (PFX##_empty(_set_)) \
|
||||
{ \
|
||||
_set_->root = PFX##_impl_new_node(element); \
|
||||
_set_->root = PFX##_impl_new_node(_set_, element); \
|
||||
\
|
||||
if (!_set_->root) \
|
||||
return false; \
|
||||
@@ -417,7 +417,7 @@ struct cmc_callbacks_treeset
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
parent->right = PFX##_impl_new_node(element); \
|
||||
parent->right = PFX##_impl_new_node(_set_, element); \
|
||||
\
|
||||
if (!parent->right) \
|
||||
return false; \
|
||||
@@ -459,7 +459,7 @@ struct cmc_callbacks_treeset
|
||||
node->parent->left = NULL; \
|
||||
} \
|
||||
\
|
||||
free(node); \
|
||||
_set_->alloc->free(node); \
|
||||
} \
|
||||
else if (node->left == NULL) \
|
||||
{ \
|
||||
@@ -480,7 +480,7 @@ struct cmc_callbacks_treeset
|
||||
node->parent->left = node->right; \
|
||||
} \
|
||||
\
|
||||
free(node); \
|
||||
_set_->alloc->free(node); \
|
||||
} \
|
||||
else if (node->right == NULL) \
|
||||
{ \
|
||||
@@ -501,7 +501,7 @@ struct cmc_callbacks_treeset
|
||||
node->parent->left = node->left; \
|
||||
} \
|
||||
\
|
||||
free(node); \
|
||||
_set_->alloc->free(node); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
@@ -539,7 +539,7 @@ struct cmc_callbacks_treeset
|
||||
temp->parent->left = temp->left; \
|
||||
} \
|
||||
\
|
||||
free(temp); \
|
||||
_set_->alloc->free(temp); \
|
||||
\
|
||||
node->value = temp_value; \
|
||||
} \
|
||||
@@ -892,7 +892,7 @@ struct cmc_callbacks_treeset
|
||||
\
|
||||
struct SNAME##_iter *PFX##_iter_new(struct SNAME *target) \
|
||||
{ \
|
||||
struct SNAME##_iter *iter = malloc(sizeof(struct SNAME##_iter)); \
|
||||
struct SNAME##_iter *iter = target->alloc->malloc(sizeof(struct SNAME##_iter)); \
|
||||
\
|
||||
if (!iter) \
|
||||
return NULL; \
|
||||
@@ -904,7 +904,7 @@ struct cmc_callbacks_treeset
|
||||
\
|
||||
void PFX##_iter_free(struct SNAME##_iter *iter) \
|
||||
{ \
|
||||
free(iter); \
|
||||
iter->target->alloc->free(iter); \
|
||||
} \
|
||||
\
|
||||
void PFX##_iter_init(struct SNAME##_iter *iter, struct SNAME *target) \
|
||||
@@ -1117,9 +1117,9 @@ struct cmc_callbacks_treeset
|
||||
return iter->index; \
|
||||
} \
|
||||
\
|
||||
static struct SNAME##_node *PFX##_impl_new_node(V element) \
|
||||
static struct SNAME##_node *PFX##_impl_new_node(struct SNAME *_set_, V element) \
|
||||
{ \
|
||||
struct SNAME##_node *node = malloc(sizeof(struct SNAME##_node)); \
|
||||
struct SNAME##_node *node = _set_->alloc->malloc(sizeof(struct SNAME##_node)); \
|
||||
\
|
||||
if (!node) \
|
||||
return NULL; \
|
||||
|
||||
Reference in new issue
Block a user