From ac1e8f40d4a5c380d68bb6f1c7cef6f1e7987c1a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 13 Apr 2010 12:25:42 +0000 Subject: * Use a symbol table to represent identifiers and attribute names efficiently. The symbol table ensures that there is only one copy of each symbol, thus allowing symbols to be compared efficiently using a pointer equality test. --- src/libexpr/nixexpr.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libexpr/nixexpr.cc') diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 1902e23b004a..922066c234a4 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -54,7 +54,7 @@ void ExprAttrs::show(std::ostream & str) { if (recursive) str << "rec "; str << "{ "; - foreach (list::iterator, i, inherited) + foreach (list::iterator, i, inherited) str << "inherit " << *i << "; "; foreach (Attrs::iterator, i, attrs) str << i->first << " = " << *i->second << "; "; @@ -81,9 +81,9 @@ void ExprLambda::show(std::ostream & str) if (i->def) str << " ? " << *i->def; } str << " }"; - if (arg != "") str << " @ "; + if (!arg.empty()) str << " @ "; } - if (arg != "") str << arg; + if (!arg.empty()) str << arg; str << ": " << *body << ")"; } -- cgit 1.4.1