Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Chris Müller
crystal
Commits
5dcad80f
Commit
5dcad80f
authored
Nov 02, 2012
by
Chris Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: use new name convention for red-black trees
parent
f6e96254
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
tools/graphview.c
tools/graphview.c
+9
-9
No files found.
tools/graphview.c
View file @
5dcad80f
...
...
@@ -8,11 +8,11 @@
static
const
char
*
RB_TREE_IDENTIFIER
=
"rbtree"
;
static
struct
RB
Tree
*
static
struct
CryRb
Tree
*
file_parse_red_black_tree
(
FILE
*
file
)
{
struct
RB
Tree
*
tree
=
rb
_
tree_new
(
cry_int_compare
);
struct
RB
Node
*
node
=
0
;
struct
CryRb
Tree
*
tree
=
cry_
rbtree_new
(
cry_int_compare
);
struct
CryRb
Node
*
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
RB
Node
*
node
)
red_black_tree_graph
(
Agraph_t
*
graph
,
struct
CryRb
Node
*
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
RB
Tree
*
tree
=
file_parse_red_black_tree
(
opfile
);
struct
CryRb
Tree
*
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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment