* Cleanup.
This commit is contained in:
parent
1b7840b949
commit
11158028be
6 changed files with 16 additions and 16 deletions
|
@ -46,7 +46,7 @@ Expr findAlongAttrPath(EvalState & state, const string & attrPath,
|
||||||
|
|
||||||
if (apType == apAttr) {
|
if (apType == apAttr) {
|
||||||
|
|
||||||
ATermMap attrs(128);
|
ATermMap attrs;
|
||||||
|
|
||||||
if (!isAttrs(state, e, attrs))
|
if (!isAttrs(state, e, attrs))
|
||||||
throw TypeError(
|
throw TypeError(
|
||||||
|
|
|
@ -37,7 +37,7 @@ static Expr substArgs(EvalState & state,
|
||||||
ATermMap subs(nrFormals);
|
ATermMap subs(nrFormals);
|
||||||
|
|
||||||
/* Get the actual arguments and put them in the substitution. */
|
/* Get the actual arguments and put them in the substitution. */
|
||||||
ATermMap args(128); /* !!! fix */
|
ATermMap args;
|
||||||
queryAllAttrs(arg, args);
|
queryAllAttrs(arg, args);
|
||||||
for (ATermMap::const_iterator i = args.begin(); i != args.end(); ++i)
|
for (ATermMap::const_iterator i = args.begin(); i != args.end(); ++i)
|
||||||
subs.set(i->key, i->value);
|
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. */
|
/* Note: e1 and e2 should be in normal form. */
|
||||||
|
|
||||||
ATermMap attrs(128); /* !!! */
|
ATermMap attrs;
|
||||||
queryAllAttrs(e1, attrs, true);
|
queryAllAttrs(e1, attrs, true);
|
||||||
queryAllAttrs(e2, attrs, true);
|
queryAllAttrs(e2, attrs, true);
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ Expr autoCallFunction(Expr e, const ATermMap & args)
|
||||||
ATerm body, pos;
|
ATerm body, pos;
|
||||||
|
|
||||||
if (matchFunction(e, formals, body, pos)) {
|
if (matchFunction(e, formals, body, pos)) {
|
||||||
ATermMap actualArgs(128);
|
ATermMap actualArgs(ATgetLength(formals));
|
||||||
|
|
||||||
for (ATermIterator i(formals); i; ++i) {
|
for (ATermIterator i(formals); i; ++i) {
|
||||||
Expr name, def, value; ATerm values, def2;
|
Expr name, def, value; ATerm values, def2;
|
||||||
|
@ -496,7 +496,7 @@ Expr evalExpr2(EvalState & state, Expr e)
|
||||||
|
|
||||||
/* Withs. */
|
/* Withs. */
|
||||||
if (matchWith(e, e1, e2, pos)) {
|
if (matchWith(e, e1, e2, pos)) {
|
||||||
ATermMap attrs(128); /* !!! */
|
ATermMap attrs;
|
||||||
try {
|
try {
|
||||||
e1 = evalExpr(state, e1);
|
e1 = evalExpr(state, e1);
|
||||||
queryAllAttrs(e1, attrs);
|
queryAllAttrs(e1, attrs);
|
||||||
|
@ -550,7 +550,7 @@ Expr evalExpr2(EvalState & state, Expr e)
|
||||||
|
|
||||||
/* Attribute existence test (?). */
|
/* Attribute existence test (?). */
|
||||||
if (matchOpHasAttr(e, e1, name)) {
|
if (matchOpHasAttr(e, e1, name)) {
|
||||||
ATermMap attrs(128); /* !!! */
|
ATermMap attrs;
|
||||||
queryAllAttrs(evalExpr(state, e1), attrs);
|
queryAllAttrs(evalExpr(state, e1), attrs);
|
||||||
return makeBool(attrs.get(name) != 0);
|
return makeBool(attrs.get(name) != 0);
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ Expr evalExpr2(EvalState & state, Expr e)
|
||||||
if (matchAttrs(e1, as) && matchPath(e2, p)) {
|
if (matchAttrs(e1, as) && matchPath(e2, p)) {
|
||||||
static bool haveWarned = false;
|
static bool haveWarned = false;
|
||||||
warnOnce(haveWarned, format(
|
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%'")
|
"you should write `drv + \"%1%\"' instead of `drv + %1%'")
|
||||||
% aterm2String(p));
|
% aterm2String(p));
|
||||||
PathSet context;
|
PathSet context;
|
||||||
|
|
|
@ -44,7 +44,7 @@ static void printTermAsXML(Expr e, XMLWriter & doc, PathSet & context)
|
||||||
|
|
||||||
else if (matchAttrs(e, as)) {
|
else if (matchAttrs(e, as)) {
|
||||||
XMLOpenElement _(doc, "attrs");
|
XMLOpenElement _(doc, "attrs");
|
||||||
ATermMap attrs(128);
|
ATermMap attrs;
|
||||||
queryAllAttrs(e, attrs);
|
queryAllAttrs(e, attrs);
|
||||||
StringSet names;
|
StringSet names;
|
||||||
for (ATermMap::const_iterator i = attrs.begin(); i != attrs.end(); ++i)
|
for (ATermMap::const_iterator i = attrs.begin(); i != attrs.end(); ++i)
|
||||||
|
|
|
@ -43,7 +43,7 @@ MetaInfo DrvInfo::queryMetaInfo(EvalState & state) const
|
||||||
Expr a = attrs->get(toATerm("meta"));
|
Expr a = attrs->get(toATerm("meta"));
|
||||||
if (!a) return meta; /* fine, empty meta information */
|
if (!a) return meta; /* fine, empty meta information */
|
||||||
|
|
||||||
ATermMap attrs2(16); /* !!! */
|
ATermMap attrs2;
|
||||||
queryAllAttrs(evalExpr(state, a), attrs2);
|
queryAllAttrs(evalExpr(state, a), attrs2);
|
||||||
|
|
||||||
for (ATermMap::const_iterator i = attrs2.begin(); i != attrs2.end(); ++i) {
|
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);
|
e = evalExpr(state, e);
|
||||||
if (!matchAttrs(e, es)) return true;
|
if (!matchAttrs(e, es)) return true;
|
||||||
|
|
||||||
boost::shared_ptr<ATermMap> attrs(new ATermMap(32)); /* !!! */
|
boost::shared_ptr<ATermMap> attrs(new ATermMap());
|
||||||
queryAllAttrs(e, *attrs, false);
|
queryAllAttrs(e, *attrs, false);
|
||||||
|
|
||||||
Expr a = attrs->get(toATerm("type"));
|
Expr a = attrs->get(toATerm("type"));
|
||||||
|
|
|
@ -21,7 +21,7 @@ static Expr primBuiltins(EvalState & state, const ATermVector & args)
|
||||||
calling a primop `foo' directly, they could say `if builtins ?
|
calling a primop `foo' directly, they could say `if builtins ?
|
||||||
foo then builtins.foo ... else ...'. */
|
foo then builtins.foo ... else ...'. */
|
||||||
|
|
||||||
ATermMap builtins(128);
|
ATermMap builtins(state.primOps.size());
|
||||||
|
|
||||||
for (ATermMap::const_iterator i = state.primOps.begin();
|
for (ATermMap::const_iterator i = state.primOps.begin();
|
||||||
i != state.primOps.end(); ++i)
|
i != state.primOps.end(); ++i)
|
||||||
|
@ -133,7 +133,7 @@ static Expr primDerivationStrict(EvalState & state, const ATermVector & args)
|
||||||
{
|
{
|
||||||
startNest(nest, lvlVomit, "evaluating derivation");
|
startNest(nest, lvlVomit, "evaluating derivation");
|
||||||
|
|
||||||
ATermMap attrs(128); /* !!! */
|
ATermMap attrs;
|
||||||
queryAllAttrs(evalExpr(state, args[0]), attrs, true);
|
queryAllAttrs(evalExpr(state, args[0]), attrs, true);
|
||||||
|
|
||||||
/* Figure out the name already (for stack backtraces). */
|
/* 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)
|
static Expr primDerivationLazy(EvalState & state, const ATermVector & args)
|
||||||
{
|
{
|
||||||
Expr eAttrs = evalExpr(state, args[0]);
|
Expr eAttrs = evalExpr(state, args[0]);
|
||||||
ATermMap attrs(128); /* !!! */
|
ATermMap attrs;
|
||||||
queryAllAttrs(eAttrs, attrs, true);
|
queryAllAttrs(eAttrs, attrs, true);
|
||||||
|
|
||||||
attrs.set(toATerm("type"),
|
attrs.set(toATerm("type"),
|
||||||
|
@ -625,7 +625,7 @@ static Expr primGetEnv(EvalState & state, const ATermVector & args)
|
||||||
list of strings. */
|
list of strings. */
|
||||||
static Expr primAttrNames(EvalState & state, const ATermVector & args)
|
static Expr primAttrNames(EvalState & state, const ATermVector & args)
|
||||||
{
|
{
|
||||||
ATermMap attrs(128); /* !!! */
|
ATermMap attrs;
|
||||||
queryAllAttrs(evalExpr(state, args[0]), attrs);
|
queryAllAttrs(evalExpr(state, args[0]), attrs);
|
||||||
|
|
||||||
StringSet names;
|
StringSet names;
|
||||||
|
@ -689,7 +689,7 @@ static Expr primHasAttr(EvalState & state, const ATermVector & args)
|
||||||
|
|
||||||
static Expr primRemoveAttrs(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);
|
queryAllAttrs(evalExpr(state, args[0]), attrs, true);
|
||||||
|
|
||||||
ATermList list = evalList(state, args[1]);
|
ATermList list = evalList(state, args[1]);
|
||||||
|
|
|
@ -40,7 +40,7 @@ public:
|
||||||
|
|
||||||
/* Create a map. `expectedCount' is the number of elements the
|
/* Create a map. `expectedCount' is the number of elements the
|
||||||
map is expected to hold. */
|
map is expected to hold. */
|
||||||
ATermMap(unsigned int expectedCount);
|
ATermMap(unsigned int expectedCount = 16);
|
||||||
|
|
||||||
ATermMap(const ATermMap & map);
|
ATermMap(const ATermMap & map);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue