aboutsummaryrefslogtreecommitdiff
path: root/collections/map/map.c
diff options
context:
space:
mode:
Diffstat (limited to 'collections/map/map.c')
-rw-r--r--collections/map/map.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/collections/map/map.c b/collections/map/map.c
index 8bfd885..701e217 100644
--- a/collections/map/map.c
+++ b/collections/map/map.c
@@ -17,6 +17,36 @@ struct map_node {
struct map_node *left, *right, *parent;
};
+void map_free_aux(root)
+struct map_node *root;
+{
+ if (!root)
+ return;
+
+ map_free_aux(root->left);
+ root->left = NULL;
+
+ map_free_aux(root->right);
+ root->right= NULL;
+
+ root->parent = NULL;
+
+ free(root);
+ return;
+}
+
+void map_free(root)
+map *root;
+{
+ if (!root)
+ return;
+
+ map_free_aux(root->root);
+
+ free(root);
+ return;
+}
+
int map_height(root)
struct map_node *root;
{
@@ -398,33 +428,3 @@ map *root;
map_clear_aux(root->root);
root->root = NULL;
}
-
-void map_free_aux(root)
-struct map_node *root;
-{
- if (!root)
- return;
-
- map_free_aux(root->left);
- root->left = NULL;
-
- map_free_aux(root->right);
- root->right= NULL;
-
- root->parent = NULL;
-
- free(root);
- return;
-}
-
-void map_free(root)
-map *root;
-{
- if (!root)
- return;
-
- map_free_aux(root->root);
-
- free(root);
- return;
-}