# HG changeset patch # User Mike Becker # Date 1456498818 -3600 # Node ID dee5a88c4db7d41689752e1d3504eeb30bcfbac2 # Parent e0853e077770424ad4f508a9a7a6f3f7c9823979 added casts for mallocs in AVL implementation (to satisfy c++ compiler) diff -r e0853e077770 -r dee5a88c4db7 ucx/avl.c --- a/ucx/avl.c Fri Feb 26 14:59:52 2016 +0100 +++ b/ucx/avl.c Fri Feb 26 16:00:18 2016 +0100 @@ -29,6 +29,8 @@ #include "avl.h" #define ptrcast(ptr) ((void*)(ptr)) +#define alloc_tree(al) (UcxAVLTree*) almalloc((al), sizeof(UcxAVLTree)) +#define alloc_node(al) (UcxAVLNode*) almalloc((al), sizeof(UcxAVLNode)) static void ucx_avl_connect(UcxAVLTree *tree, UcxAVLNode *node, UcxAVLNode *child, intptr_t nullkey) { @@ -107,7 +109,7 @@ } UcxAVLTree *ucx_avl_new_a(cmp_func cmpfunc, UcxAllocator *allocator) { - UcxAVLTree *tree = almalloc(allocator, sizeof(UcxAVLTree)); + UcxAVLTree* tree = alloc_tree(allocator); if (tree) { tree->allocator = allocator; tree->cmpfunc = cmpfunc; @@ -167,7 +169,7 @@ } if (cmpresult) { - UcxAVLNode *e = almalloc(tree->allocator, sizeof(UcxAVLNode)); + UcxAVLNode* e = alloc_node(tree->allocator); if (e) { e->key = key; e->value = value; e->height = 1; e->parent = e->left = e->right = NULL; @@ -185,7 +187,7 @@ return 0; } } else { - tree->root = almalloc(tree->allocator, sizeof(UcxAVLNode)); + tree->root = alloc_node(tree->allocator); if (tree->root) { tree->root->key = key; tree->root->value = value; tree->root->height = 1;