diff options
author | Tucker Evans <tucker@tuckerevans.com> | 2020-07-06 19:48:13 -0400 |
---|---|---|
committer | Tucker Evans <tucker@tuckerevans.com> | 2020-07-08 10:56:36 -0400 |
commit | 0cca188d0ccbfe3d87805c74b63fef72a58a2b84 (patch) | |
tree | 9d475734e06ea8ee0419599e1b02f0289865f17a /collections | |
parent | 20c79049e9b0a6a1aa47b1b9dacfbb31b6e7c992 (diff) |
Add new_from_parent function for maps
Allows setting the parent field and cmp members in a simple way.
Diffstat (limited to 'collections')
-rw-r--r-- | collections/map/map.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/collections/map/map.c b/collections/map/map.c index beb8f7f..1b6cbaa 100644 --- a/collections/map/map.c +++ b/collections/map/map.c @@ -26,6 +26,16 @@ cmp_func cmp; return tmp; } +map* map_new_from_parent(root) +map *root; +{ + map *tmp; + + tmp = map_new(root->cmp); + tmp->parent = root; + return tmp; +} + int map_size(root) map *root; { |