From 0cca188d0ccbfe3d87805c74b63fef72a58a2b84 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Mon, 6 Jul 2020 19:48:13 -0400 Subject: Add new_from_parent function for maps Allows setting the parent field and cmp members in a simple way. --- collections/map/map.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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; { -- cgit v1.1