Fri, 26 Feb 2016 16:00:18 +0100
added casts for mallocs in AVL implementation (to satisfy c++ compiler)
ucx/avl.c | file | annotate | diff | comparison | revisions |
1.1 --- a/ucx/avl.c Fri Feb 26 14:59:52 2016 +0100 1.2 +++ b/ucx/avl.c Fri Feb 26 16:00:18 2016 +0100 1.3 @@ -29,6 +29,8 @@ 1.4 #include "avl.h" 1.5 1.6 #define ptrcast(ptr) ((void*)(ptr)) 1.7 +#define alloc_tree(al) (UcxAVLTree*) almalloc((al), sizeof(UcxAVLTree)) 1.8 +#define alloc_node(al) (UcxAVLNode*) almalloc((al), sizeof(UcxAVLNode)) 1.9 1.10 static void ucx_avl_connect(UcxAVLTree *tree, 1.11 UcxAVLNode *node, UcxAVLNode *child, intptr_t nullkey) { 1.12 @@ -107,7 +109,7 @@ 1.13 } 1.14 1.15 UcxAVLTree *ucx_avl_new_a(cmp_func cmpfunc, UcxAllocator *allocator) { 1.16 - UcxAVLTree *tree = almalloc(allocator, sizeof(UcxAVLTree)); 1.17 + UcxAVLTree* tree = alloc_tree(allocator); 1.18 if (tree) { 1.19 tree->allocator = allocator; 1.20 tree->cmpfunc = cmpfunc; 1.21 @@ -167,7 +169,7 @@ 1.22 } 1.23 1.24 if (cmpresult) { 1.25 - UcxAVLNode *e = almalloc(tree->allocator, sizeof(UcxAVLNode)); 1.26 + UcxAVLNode* e = alloc_node(tree->allocator); 1.27 if (e) { 1.28 e->key = key; e->value = value; e->height = 1; 1.29 e->parent = e->left = e->right = NULL; 1.30 @@ -185,7 +187,7 @@ 1.31 return 0; 1.32 } 1.33 } else { 1.34 - tree->root = almalloc(tree->allocator, sizeof(UcxAVLNode)); 1.35 + tree->root = alloc_node(tree->allocator); 1.36 if (tree->root) { 1.37 tree->root->key = key; tree->root->value = value; 1.38 tree->root->height = 1;