diff options
Diffstat (limited to 'src/libexpr/nixexpr.cc')
-rw-r--r-- | src/libexpr/nixexpr.cc | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 92027a70ebd7..7739e99a96be 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -20,8 +20,7 @@ ATermMap::ATermMap(const ATermMap & map) table = ATtableCreate(ATgetLength(keys), maxLoadPct); if (!table) throw Error("cannot create ATerm table"); - for (ATermIterator i(keys); i; ++i) - set(*i, map.get(*i)); + add(map, keys); } @@ -75,6 +74,26 @@ ATermList ATermMap::keys() const } +void ATermMap::add(const ATermMap & map) +{ + ATermList keys = map.keys(); + add(map, keys); +} + + +void ATermMap::add(const ATermMap & map, ATermList & keys) +{ + for (ATermIterator i(keys); i; ++i) + set(*i, map.get(*i)); +} + + +void ATermMap::reset() +{ + ATtableReset(table); +} + + ATerm string2ATerm(const string & s) { return (ATerm) ATmakeAppl0(ATmakeAFun((char *) s.c_str(), 0, ATtrue)); |