From 0690c1c9c01dd5889dbfccf2da6cb99f5c4e151b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 3 Nov 2003 20:30:40 +0000 Subject: * Work around problems with the ATerm library. The ATerm library doesn't search the heap for pointers to ATerms when garbage collecting. As a result, C++ containers such as `map' will cause pointer to be hidden from the garbage collector, causing crashes. Instead, we now use ATermTables. --- src/fix-ng/primops.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src/fix-ng/primops.cc') diff --git a/src/fix-ng/primops.cc b/src/fix-ng/primops.cc index f887d265f326..ef0fd354ef6d 100644 --- a/src/fix-ng/primops.cc +++ b/src/fix-ng/primops.cc @@ -123,7 +123,7 @@ Expr primDerivation(EvalState & state, Expr args) { Nest nest(lvlVomit, "evaluating derivation"); - Attrs attrs; + ATermMap attrs; args = evalExpr(state, args); queryAllAttrs(args, attrs); @@ -136,9 +136,11 @@ Expr primDerivation(EvalState & state, Expr args) Hash outHash; bool outHashGiven = false; - for (Attrs::iterator i = attrs.begin(); i != attrs.end(); i++) { - string key = i->first; - Expr value = i->second; + for (ATermList keys = attrs.keys(); !ATisEmpty(keys); + keys = ATgetNext(keys)) + { + string key = aterm2String(ATgetFirst(keys)); + Expr value = attrs.get(key); Nest nest(lvlVomit, format("processing attribute `%1%'") % key); /* The `args' attribute is special: it supplies the @@ -198,9 +200,9 @@ Expr primDerivation(EvalState & state, Expr args) msg(lvlChatty, format("instantiated `%1%' -> `%2%'") % drvName % drvPath); - attrs["outPath"] = ATmake("Path()", outPath.c_str()); - attrs["drvPath"] = ATmake("Path()", drvPath.c_str()); - attrs["type"] = ATmake("Str(\"derivation\")"); + attrs.set("outPath", ATmake("Path()", outPath.c_str())); + attrs.set("drvPath", ATmake("Path()", drvPath.c_str())); + attrs.set("type", ATmake("Str(\"derivation\")")); return makeAttrs(attrs); } -- cgit 1.4.1