diff options
Diffstat (limited to 'collections/map/map.c')
-rw-r--r-- | collections/map/map.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/collections/map/map.c b/collections/map/map.c index 21af21c..803b5ad 100644 --- a/collections/map/map.c +++ b/collections/map/map.c @@ -1,7 +1,9 @@ #include "map.h" #include <string.h> +#include <stdlib.h> #include <stdio.h> +#include <assert.h> struct map_node { void *key, *val; @@ -9,3 +11,17 @@ struct map_node { struct map_node *left, *right, *parent; }; + +map* map_new(cmp) +cmp_func cmp; +{ + map *tmp; + + tmp = malloc(sizeof(map)); + assert(tmp); + + tmp->cmp = cmp; + tmp->key = tmp->val = tmp->left = tmp->right = tmp->parent = NULL; + + return tmp; +} |