free edge struct
This commit is contained in:
parent
7d288404c7
commit
6762025fe6
4 changed files with 26 additions and 23 deletions
|
@ -85,5 +85,7 @@ void r3_edge_free(edge * e) {
|
|||
if ( e->child ) {
|
||||
r3_tree_free(e->child);
|
||||
}
|
||||
// free itself
|
||||
zfree(e);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,16 +65,17 @@ node * r3_tree_create(int cap) {
|
|||
}
|
||||
|
||||
void r3_tree_free(node * tree) {
|
||||
if (tree) {
|
||||
for (int i = 0 ; i < tree->edge_len ; i++ ) {
|
||||
if (tree->edges[i]) {
|
||||
r3_edge_free(tree->edges[ i ]);
|
||||
}
|
||||
}
|
||||
if (tree->edges)
|
||||
if (tree->edges) {
|
||||
zfree(tree->edges);
|
||||
if (tree->routes)
|
||||
}
|
||||
if (tree->routes) {
|
||||
zfree(tree->routes);
|
||||
}
|
||||
/*
|
||||
if (tree->pcre_pattern)
|
||||
zfree(tree->pcre_pattern);
|
||||
|
@ -88,7 +89,6 @@ void r3_tree_free(node * tree) {
|
|||
zfree(tree);
|
||||
tree = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -443,3 +443,4 @@
|
|||
1400659046,19754150.71
|
||||
1400666823,6406965.25
|
||||
1400666950,6684744.95
|
||||
1400667091,6771202.47
|
||||
|
|
|
|
@ -20,9 +20,9 @@ END_TEST
|
|||
START_TEST (test_r3_node_construct_and_free)
|
||||
{
|
||||
node * n = r3_tree_create(10);
|
||||
node * child = r3_tree_create(3);
|
||||
node * another_tree = r3_tree_create(3);
|
||||
r3_tree_free(n);
|
||||
r3_tree_free(child);
|
||||
r3_tree_free(another_tree);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
|
Loading…
Reference in a new issue