OLD | NEW |
1 #include "util.h" | 1 #include "util.h" |
2 /*@unused@*/ RCSID("$Id: inttree.c 1893 2007-07-14 03:11:32Z peter $"); | 2 /*@unused@*/ RCSID("$Id: inttree.c 2262 2010-01-03 02:46:11Z peter $"); |
3 | 3 |
4 #include <stdlib.h> | 4 #include <stdlib.h> |
5 #include <stdio.h> | 5 #include <stdio.h> |
6 #include <limits.h> | 6 #include <limits.h> |
7 #include <math.h> | 7 #include <math.h> |
8 #include "coretype.h" | 8 #include "coretype.h" |
9 #include "inttree.h" | 9 #include "inttree.h" |
10 | 10 |
11 #define VERIFY(condition) \ | 11 #define VERIFY(condition) \ |
12 if (!(condition)) { \ | 12 if (!(condition)) { \ |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 TreePrintHelper(it, x->left); | 485 TreePrintHelper(it, x->left); |
486 ITN_print(x, it->nil, it->root); | 486 ITN_print(x, it->nil, it->root); |
487 TreePrintHelper(it, x->right); | 487 TreePrintHelper(it, x->right); |
488 } | 488 } |
489 } | 489 } |
490 | 490 |
491 void | 491 void |
492 IT_destroy(IntervalTree *it) | 492 IT_destroy(IntervalTree *it) |
493 { | 493 { |
494 IntervalTreeNode *x = it->root->left; | 494 IntervalTreeNode *x = it->root->left; |
495 SLIST_HEAD(, nodeent) stuffToFree = SLIST_HEAD_INITIALIZER(stuffToFree); | 495 SLIST_HEAD(node_head, nodeent) |
| 496 stuffToFree = SLIST_HEAD_INITIALIZER(stuffToFree); |
496 struct nodeent { | 497 struct nodeent { |
497 SLIST_ENTRY(nodeent) link; | 498 SLIST_ENTRY(nodeent) link; |
498 struct IntervalTreeNode *node; | 499 struct IntervalTreeNode *node; |
499 } *np; | 500 } *np; |
500 | 501 |
501 if (x != it->nil) { | 502 if (x != it->nil) { |
502 if (x->left != it->nil) { | 503 if (x->left != it->nil) { |
503 np = yasm_xmalloc(sizeof(struct nodeent)); | 504 np = yasm_xmalloc(sizeof(struct nodeent)); |
504 np->node = x->left; | 505 np->node = x->left; |
505 SLIST_INSERT_HEAD(&stuffToFree, np, link); | 506 SLIST_INSERT_HEAD(&stuffToFree, np, link); |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 VERIFY(it->root->high == INT_MAX); | 883 VERIFY(it->root->high == INT_MAX); |
883 VERIFY(it->root->maxHigh == INT_MAX); | 884 VERIFY(it->root->maxHigh == INT_MAX); |
884 VERIFY(it->nil->data == NULL); | 885 VERIFY(it->nil->data == NULL); |
885 VERIFY(it->root->data == NULL); | 886 VERIFY(it->root->data == NULL); |
886 VERIFY(it->nil->red == 0); | 887 VERIFY(it->nil->red == 0); |
887 VERIFY(it->root->red == 0); | 888 VERIFY(it->root->red == 0); |
888 CheckMaxHighFields(it, it->root->left); | 889 CheckMaxHighFields(it, it->root->left); |
889 } | 890 } |
890 #endif | 891 #endif |
891 | 892 |
OLD | NEW |