Commit 5dcad80f authored by Chris Müller's avatar Chris Müller

tools: use new name convention for red-black trees

parent f6e96254
......@@ -8,11 +8,11 @@
static const char* RB_TREE_IDENTIFIER = "rbtree";
static struct RBTree*
static struct CryRbTree*
file_parse_red_black_tree(FILE* file)
{
struct RBTree* tree = rb_tree_new(cry_int_compare);
struct RBNode* node = 0;
struct CryRbTree* tree = cry_rbtree_new(cry_int_compare);
struct CryRbNode* node = 0;
char buffer[64];
int* integer = 0;
......@@ -27,7 +27,7 @@ file_parse_red_black_tree(FILE* file)
case '+':
integer = cry_malloc(int);
*integer = atoi(buffer + 2);
if(rb_tree_insert(tree, integer) == 0) {
if(cry_rbtree_insert(tree, integer, 0) == 0) {
fprintf(stderr, "Value %d already added.\n", *integer);
cry_free(integer);
}
......@@ -35,10 +35,10 @@ file_parse_red_black_tree(FILE* file)
break;
case '-':
tmp = atoi(buffer + 2);
if( (node = rb_tree_remove(tree, &tmp)) == 0)
if( (node = cry_rbtree_remove(tree, &tmp)) == 0)
fprintf(stderr, "Value %d is not in tree.\n", tmp);
else
rb_node_free(node, cry_free);
cry_rbnode_free(node, cry_free, 0);
break;
default:
......@@ -54,7 +54,7 @@ file_parse_red_black_tree(FILE* file)
static Agnode_t*
red_black_tree_graph(Agraph_t* graph, struct RBNode* node)
red_black_tree_graph(Agraph_t* graph, struct CryRbNode* node)
{
char key[32];
......@@ -98,13 +98,13 @@ graph_generator(FILE* opfile, GVC_t* gvc, const char* graphtype)
Agraph_t* graph = 0;
if(strcmp(graphtype, RB_TREE_IDENTIFIER) == 0) {
struct RBTree* tree = file_parse_red_black_tree(opfile);
struct CryRbTree* tree = file_parse_red_black_tree(opfile);
graph = agopen("red_black_tree", AGRAPH);
if(tree->root != 0)
red_black_tree_graph(graph, tree->root);
rb_tree_clear(tree, free);
cry_rbtree_clear(tree, free, 0);
cry_free(tree);
if(graph != 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment