- Timestamp:
- Oct 21, 2011, 1:08:28 AM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/cutest_zAVLTree.c
r17 r363 44 44 CuAssertTrue(tc, NULL == ptr); 45 45 46 ztest_tree = zAVLAllocTree (ztest_key );46 ztest_tree = zAVLAllocTree (ztest_key, zAVL_KEY_STRING); 47 47 CuAssertPtrNotNull(tc, ztest_tree); 48 48 -
trunk/src/sh_files.c
r362 r363 897 897 if (zfileList == NULL) 898 898 { 899 zfileList = zAVLAllocTree (zdirstack_key );899 zfileList = zAVLAllocTree (zdirstack_key, zAVL_KEY_STRING); 900 900 if (zfileList == NULL) 901 901 { … … 975 975 if (zglobList == NULL) 976 976 { 977 zglobList = zAVLAllocTree (zdirstack_key );977 zglobList = zAVLAllocTree (zdirstack_key, zAVL_KEY_STRING); 978 978 if (zglobList == NULL) 979 979 { … … 1456 1456 if (tree == NULL) 1457 1457 { 1458 tree = zAVLAllocTree (zdirstack_key );1458 tree = zAVLAllocTree (zdirstack_key, zAVL_KEY_STRING); 1459 1459 if (tree == NULL) 1460 1460 { -
trunk/src/sh_forward.c
r342 r363 2088 2088 if (all_clients == NULL) 2089 2089 { 2090 all_clients = zAVLAllocTree (sh_avl_key );2090 all_clients = zAVLAllocTree (sh_avl_key, zAVL_KEY_STRING); 2091 2091 if (all_clients == NULL) 2092 2092 { -
trunk/src/sh_log_evalrule.c
r357 r363 1122 1122 { 1123 1123 DEBUG("debug: allocate new counterlist AVL tree\n"); 1124 rule->counterlist = zAVLAllocTree(sh_eval_getkey );1124 rule->counterlist = zAVLAllocTree(sh_eval_getkey, zAVL_KEY_STRING); 1125 1125 } 1126 1126 -
trunk/src/sh_log_mark.c
r272 r363 77 77 if (!(marklist)) 78 78 { 79 marklist = zAVLAllocTree(sh_log_mark_getkey );79 marklist = zAVLAllocTree(sh_log_mark_getkey, zAVL_KEY_STRING); 80 80 } 81 81 -
trunk/src/sh_nmail.c
r304 r363 957 957 } 958 958 959 mailkeys = zAVLAllocTree (sh_nmail_getkey );959 mailkeys = zAVLAllocTree (sh_nmail_getkey, zAVL_KEY_STRING); 960 960 goto start; 961 961 } -
trunk/src/sh_utmp.c
r332 r363 558 558 559 559 #if defined(HAVE_PTHREAD) 560 static sh_watches inotify_watch ;560 static sh_watches inotify_watch = SH_INOTIFY_INITIALIZER; 561 561 #endif 562 562 -
trunk/src/zAVLTree.c
r16 r363 53 53 #define ZAVL_NO 0 54 54 55 /* The comparison function. Was a macro, but this allows for more 56 * flexibility (non-string keys). The key is a (void *) now, and 57 * the type is stored in the zAVLTree struct. Oct 21, 2011, rw 58 */ 59 static int zAVLKey_cmp(const zAVLTree * tree, zAVLKey a, zAVLKey b) 60 { 61 if (tree->keytype == zAVL_KEY_STRING) 62 { 63 return (strcmp((char*)a, (char *)b)); 64 } 65 else /* zAVL_KEY_INT */ 66 { 67 int x = *((int *)a); 68 int y = *((int *)b); 69 70 if (x > y) return 1; 71 else if (x < y) return -1; 72 else return 0; 73 } 74 } 55 75 56 76 /* … … 62 82 * was a malloc failure, then NULL is returned. 63 83 */ 64 zAVLTree *zAVLAllocTree (zAVLKey (*getkey)(void const *item) )84 zAVLTree *zAVLAllocTree (zAVLKey (*getkey)(void const *item), int keytype) 65 85 { 66 86 zAVLTree *rc; … … 73 93 rc->count = 0; 74 94 rc->getkey = getkey; 95 rc->keytype = keytype; 75 96 return rc; 76 97 }
Note:
See TracChangeset
for help on using the changeset viewer.