From 11158028be348ed9eb58bf78f4cc9711e8bfe664 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 13 Jan 2007 14:21:49 +0000 Subject: * Cleanup. --- src/libexpr/attr-path.cc | 2 +- src/libexpr/eval.cc | 12 ++++++------ src/libexpr/expr-to-xml.cc | 2 +- src/libexpr/get-drvs.cc | 4 ++-- src/libexpr/primops.cc | 10 +++++----- src/libutil/aterm-map.hh | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/libexpr/attr-path.cc b/src/libexpr/attr-path.cc index 8606da559771..e8e4c050cc84 100644 --- a/src/libexpr/attr-path.cc +++ b/src/libexpr/attr-path.cc @@ -46,7 +46,7 @@ Expr findAlongAttrPath(EvalState & state, const string & attrPath, if (apType == apAttr) { - ATermMap attrs(128); + ATermMap attrs; if (!isAttrs(state, e, attrs)) throw TypeError( diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index e58ff695c59c..8665edcfab41 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -37,7 +37,7 @@ static Expr substArgs(EvalState & state, ATermMap subs(nrFormals); /* Get the actual arguments and put them in the substitution. */ - ATermMap args(128); /* !!! fix */ + ATermMap args; queryAllAttrs(arg, args); for (ATermMap::const_iterator i = args.begin(); i != args.end(); ++i) subs.set(i->key, i->value); @@ -151,7 +151,7 @@ static Expr updateAttrs(Expr e1, Expr e2) { /* Note: e1 and e2 should be in normal form. */ - ATermMap attrs(128); /* !!! */ + ATermMap attrs; queryAllAttrs(e1, attrs, true); queryAllAttrs(e2, attrs, true); @@ -343,7 +343,7 @@ Expr autoCallFunction(Expr e, const ATermMap & args) ATerm body, pos; if (matchFunction(e, formals, body, pos)) { - ATermMap actualArgs(128); + ATermMap actualArgs(ATgetLength(formals)); for (ATermIterator i(formals); i; ++i) { Expr name, def, value; ATerm values, def2; @@ -496,7 +496,7 @@ Expr evalExpr2(EvalState & state, Expr e) /* Withs. */ if (matchWith(e, e1, e2, pos)) { - ATermMap attrs(128); /* !!! */ + ATermMap attrs; try { e1 = evalExpr(state, e1); queryAllAttrs(e1, attrs); @@ -550,7 +550,7 @@ Expr evalExpr2(EvalState & state, Expr e) /* Attribute existence test (?). */ if (matchOpHasAttr(e, e1, name)) { - ATermMap attrs(128); /* !!! */ + ATermMap attrs; queryAllAttrs(evalExpr(state, e1), attrs); return makeBool(attrs.get(name) != 0); } @@ -576,7 +576,7 @@ Expr evalExpr2(EvalState & state, Expr e) if (matchAttrs(e1, as) && matchPath(e2, p)) { static bool haveWarned = false; warnOnce(haveWarned, format( - "concatenation of a derivation and a path is deprecated, " + "concatenation of a derivation and a path is deprecated; " "you should write `drv + \"%1%\"' instead of `drv + %1%'") % aterm2String(p)); PathSet context; diff --git a/src/libexpr/expr-to-xml.cc b/src/libexpr/expr-to-xml.cc index f5b0e747705c..5c5b81b2383f 100644 --- a/src/libexpr/expr-to-xml.cc +++ b/src/libexpr/expr-to-xml.cc @@ -44,7 +44,7 @@ static void printTermAsXML(Expr e, XMLWriter & doc, PathSet & context) else if (matchAttrs(e, as)) { XMLOpenElement _(doc, "attrs"); - ATermMap attrs(128); + ATermMap attrs; queryAllAttrs(e, attrs); StringSet names; for (ATermMap::const_iterator i = attrs.begin(); i != attrs.end(); ++i) diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc index 3c7061fcd33a..ba9fbcd6dfac 100644 --- a/src/libexpr/get-drvs.cc +++ b/src/libexpr/get-drvs.cc @@ -43,7 +43,7 @@ MetaInfo DrvInfo::queryMetaInfo(EvalState & state) const Expr a = attrs->get(toATerm("meta")); if (!a) return meta; /* fine, empty meta information */ - ATermMap attrs2(16); /* !!! */ + ATermMap attrs2; queryAllAttrs(evalExpr(state, a), attrs2); for (ATermMap::const_iterator i = attrs2.begin(); i != attrs2.end(); ++i) { @@ -81,7 +81,7 @@ static bool getDerivation(EvalState & state, Expr e, e = evalExpr(state, e); if (!matchAttrs(e, es)) return true; - boost::shared_ptr attrs(new ATermMap(32)); /* !!! */ + boost::shared_ptr attrs(new ATermMap()); queryAllAttrs(e, *attrs, false); Expr a = attrs->get(toATerm("type")); diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 17fc6b523157..bc6e290a48fc 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -21,7 +21,7 @@ static Expr primBuiltins(EvalState & state, const ATermVector & args) calling a primop `foo' directly, they could say `if builtins ? foo then builtins.foo ... else ...'. */ - ATermMap builtins(128); + ATermMap builtins(state.primOps.size()); for (ATermMap::const_iterator i = state.primOps.begin(); i != state.primOps.end(); ++i) @@ -133,7 +133,7 @@ static Expr primDerivationStrict(EvalState & state, const ATermVector & args) { startNest(nest, lvlVomit, "evaluating derivation"); - ATermMap attrs(128); /* !!! */ + ATermMap attrs; queryAllAttrs(evalExpr(state, args[0]), attrs, true); /* Figure out the name already (for stack backtraces). */ @@ -303,7 +303,7 @@ static Expr primDerivationStrict(EvalState & state, const ATermVector & args) static Expr primDerivationLazy(EvalState & state, const ATermVector & args) { Expr eAttrs = evalExpr(state, args[0]); - ATermMap attrs(128); /* !!! */ + ATermMap attrs; queryAllAttrs(eAttrs, attrs, true); attrs.set(toATerm("type"), @@ -625,7 +625,7 @@ static Expr primGetEnv(EvalState & state, const ATermVector & args) list of strings. */ static Expr primAttrNames(EvalState & state, const ATermVector & args) { - ATermMap attrs(128); /* !!! */ + ATermMap attrs; queryAllAttrs(evalExpr(state, args[0]), attrs); StringSet names; @@ -689,7 +689,7 @@ static Expr primHasAttr(EvalState & state, const ATermVector & args) static Expr primRemoveAttrs(EvalState & state, const ATermVector & args) { - ATermMap attrs(128); /* !!! */ + ATermMap attrs; queryAllAttrs(evalExpr(state, args[0]), attrs, true); ATermList list = evalList(state, args[1]); diff --git a/src/libutil/aterm-map.hh b/src/libutil/aterm-map.hh index 3035b6ec5598..db36da377a79 100644 --- a/src/libutil/aterm-map.hh +++ b/src/libutil/aterm-map.hh @@ -40,7 +40,7 @@ public: /* Create a map. `expectedCount' is the number of elements the map is expected to hold. */ - ATermMap(unsigned int expectedCount); + ATermMap(unsigned int expectedCount = 16); ATermMap(const ATermMap & map); -- cgit 1.4.1