universe@192: /* universe@192: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. universe@192: * universe@192: * Copyright 2015 Olaf Wintermann. All rights reserved. universe@192: * universe@192: * Redistribution and use in source and binary forms, with or without universe@192: * modification, are permitted provided that the following conditions are met: universe@192: * universe@192: * 1. Redistributions of source code must retain the above copyright universe@192: * notice, this list of conditions and the following disclaimer. universe@192: * universe@192: * 2. Redistributions in binary form must reproduce the above copyright universe@192: * notice, this list of conditions and the following disclaimer in the universe@192: * documentation and/or other materials provided with the distribution. universe@192: * universe@192: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" universe@192: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE universe@192: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE universe@192: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE universe@192: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR universe@192: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF universe@192: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS universe@192: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN universe@192: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) universe@192: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE universe@192: * POSSIBILITY OF SUCH DAMAGE. universe@192: */ universe@192: universe@192: #include "avl.h" universe@192: universe@194: UcxAVLTree *ucx_avl_new(cmp_func cmpfunc) { universe@194: return ucx_avl_new_a(cmpfunc, ucx_default_allocator()); universe@194: } universe@194: universe@194: UcxAVLTree *ucx_avl_new_a(cmp_func cmpfunc, UcxAllocator *allocator) { universe@194: UcxAVLTree *tree = malloc(sizeof(UcxAVLTree)); universe@194: if (tree) { universe@194: tree->allocator = allocator; universe@194: tree->cmpfunc = cmpfunc; universe@194: tree->root = NULL; universe@194: tree->userdata = NULL; universe@194: } universe@194: universe@194: return tree; universe@194: } universe@194: universe@194: void *ucx_avl_get(UcxAVLTree *tree, intptr_t key) { universe@194: return NULL; universe@194: } universe@194: universe@194: void* ucx_avl_put(UcxAVLTree *tree, intptr_t key, void *value) { universe@194: return NULL; universe@194: } universe@194: universe@194: void* ucx_avl_remove(UcxAVLTree *tree, intptr_t key) { universe@194: return NULL; universe@194: } universe@194: