From e01ef57d4bf4a6580c6bbeb527e866c09efaee83 Mon Sep 17 00:00:00 2001 From: dan Date: Fri, 15 Sep 2000 05:02:01 +0000 Subject: [PATCH] Removed some unused code from the treebag --- WINGs/WUtil.h | 7 +------ WINGs/bagtree.c | 35 ++++------------------------------- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/WINGs/WUtil.h b/WINGs/WUtil.h index 8317cc92..a5fff2b7 100644 --- a/WINGs/WUtil.h +++ b/WINGs/WUtil.h @@ -333,11 +333,7 @@ extern const WMHashTableCallbacks WMStringPointerHashCallbacks; * aren't in the end * Element indexes with large difference will cause large holes */ -#if 0 -WMBag* WMCreateArrayBag(int initialSize); -WMBag* WMCreateArrayBagWithDestructor(int initialSize, - void (*destructor)(void*)); -#endif + /* * Tree bags use a red-black tree for storage. * Item indexes may be any integer number. @@ -417,7 +413,6 @@ void* WMBagIteratorAtIndex(WMBag *self, int index, WMBagIterator *ptr); int WMBagIndexForIterator(WMBag *bag, WMBagIterator ptr); - #define WM_ITERATE_BAG(bag, var, i) \ for (var = WMBagFirst(bag, &(i)); (i) != NULL; \ var = WMBagNext(bag, &(i))) diff --git a/WINGs/bagtree.c b/WINGs/bagtree.c index 9787ad1c..1cacb001 100644 --- a/WINGs/bagtree.c +++ b/WINGs/bagtree.c @@ -30,31 +30,6 @@ typedef struct W_Bag { } W_Bag; -#if 0 -static int getItemCount(WMBag *self); -static int appendBag(WMBag *self, WMBag *bag); -static int putInBag(WMBag *self, void *item); -static int insertInBag(WMBag *self, int index, void *item); -static int removeFromBag(WMBag *bag, void *item); -static int eraseFromBag(WMBag *bag, int index); -static int deleteFromBag(WMBag *bag, int index); -static void *getFromBag(WMBag *bag, int index); -static int countInBag(WMBag *bag, void *item); -static int firstInBag(WMBag *bag, void *item); -static void *replaceInBag(WMBag *bag, int index, void *item); -static int sortBag(WMBag *bag, int (*comparer)(const void*, const void*)); -static void emptyBag(WMBag *bag); -static void freeBag(WMBag *bag); -static void mapBag(WMBag *bag, void (*function)(void*, void*), void *data); -static int findInBag(WMBag *bag, int (*match)(void*,void*), void *data); -static void *first(WMBag *bag, WMBagIterator *ptr); -static void *last(WMBag *bag, WMBagIterator *ptr); -static void *next(WMBag *bag, WMBagIterator *ptr); -static void *previous(WMBag *bag, WMBagIterator *ptr); -static void *iteratorAtIndex(WMBag *bag, int index, WMBagIterator *ptr); -static int indexForIterator(WMBag *bag, WMBagIterator ptr); -#endif - #define IS_LEFT(node) (node == node->parent->left) #define IS_RIGHT(node) (node == node->parent->right) @@ -382,7 +357,8 @@ treeFind(W_Node *root, W_Node *nil, void *data) #if 0 static char buf[512]; -static void printNodes(W_Node *node, W_Node *nil, int depth) +static void +printNodes(W_Node *node, W_Node *nil, int depth) { if (node == nil) { return; @@ -401,7 +377,8 @@ static void printNodes(W_Node *node, W_Node *nil, int depth) } -void PrintTree(WMBag *bag) +void +PrintTree(WMBag *bag) { W_TreeBag *tree = (W_TreeBag*)bag->data; @@ -410,8 +387,6 @@ void PrintTree(WMBag *bag) #endif -//#define SELF ((W_TreeBag*)self->data) - WMBag* WMCreateTreeBag(void) { @@ -462,14 +437,12 @@ WMAppendBag(WMBag *self, WMBag *bag) return 1; } -//extern WMBag *bla; int WMPutInBag(WMBag *self, void *item) { W_Node *ptr; - ptr = wmalloc(sizeof(W_Node)); ptr->data = item;