src/tree.c

changeset 989
8aa57a7fecc4
parent 988
15b3ca7ee33f
child 1040
1ecf4dbbc60c
equal deleted inserted replaced
988:15b3ca7ee33f 989:8aa57a7fecc4
806 ptrdiff_t loc_children, 806 ptrdiff_t loc_children,
807 ptrdiff_t loc_last_child, 807 ptrdiff_t loc_last_child,
808 ptrdiff_t loc_prev, 808 ptrdiff_t loc_prev,
809 ptrdiff_t loc_next 809 ptrdiff_t loc_next
810 ) { 810 ) {
811 if (allocator == NULL) {
812 allocator = cxDefaultAllocator;
813 }
814 assert(create_func != NULL);
815 assert(search_func != NULL);
816 assert(search_data_func != NULL);
817
811 CxTree *tree = cxMalloc(allocator, sizeof(CxTree)); 818 CxTree *tree = cxMalloc(allocator, sizeof(CxTree));
812 if (tree == NULL) return NULL; 819 if (tree == NULL) return NULL;
813 820
814 tree->cl = &cx_tree_default_class; 821 tree->cl = &cx_tree_default_class;
815 tree->allocator = allocator; 822 tree->allocator = allocator;
837 ptrdiff_t loc_children, 844 ptrdiff_t loc_children,
838 ptrdiff_t loc_last_child, 845 ptrdiff_t loc_last_child,
839 ptrdiff_t loc_prev, 846 ptrdiff_t loc_prev,
840 ptrdiff_t loc_next 847 ptrdiff_t loc_next
841 ) { 848 ) {
849 if (allocator == NULL) {
850 allocator = cxDefaultAllocator;
851 }
852 assert(root != NULL);
853
842 CxTree *tree = cxMalloc(allocator, sizeof(CxTree)); 854 CxTree *tree = cxMalloc(allocator, sizeof(CxTree));
843 if (tree == NULL) return NULL; 855 if (tree == NULL) return NULL;
844 856
845 tree->cl = &cx_tree_default_class; 857 tree->cl = &cx_tree_default_class;
846 // set the allocator anyway, just in case... 858 // set the allocator anyway, just in case...

mercurial