[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
234/376: printValue(): Don't print <CYCLE> for repeated values
From: |
Ludovic Courtès |
Subject: |
234/376: printValue(): Don't print <CYCLE> for repeated values |
Date: |
Wed, 28 Jan 2015 22:05:17 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit a17c23426e7b2724639cd90c23759299cdaffbb7
Author: Eelco Dolstra <address@hidden>
Date: Wed Oct 1 15:54:40 2014 +0200
printValue(): Don't print <CYCLE> for repeated values
---
src/libexpr/eval.cc | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 43d8f13..46a4259 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -38,13 +38,13 @@ void Bindings::sort()
}
-static void printValue(std::ostream & str, std::set<const Value *> & seen,
const Value & v)
+static void printValue(std::ostream & str, std::set<const Value *> & active,
const Value & v)
{
- if (seen.find(&v) != seen.end()) {
+ if (active.find(&v) != active.end()) {
str << "<CYCLE>";
return;
}
- seen.insert(&v);
+ active.insert(&v);
switch (v.type) {
case tInt:
@@ -77,7 +77,7 @@ static void printValue(std::ostream & str, std::set<const
Value *> & seen, const
sorted[i->name] = i->value;
for (auto & i : sorted) {
str << i.first << " = ";
- printValue(str, seen, *i.second);
+ printValue(str, active, *i.second);
str << "; ";
}
str << "}";
@@ -86,7 +86,7 @@ static void printValue(std::ostream & str, std::set<const
Value *> & seen, const
case tList:
str << "[ ";
for (unsigned int n = 0; n < v.list.length; ++n) {
- printValue(str, seen, *v.list.elems[n]);
+ printValue(str, active, *v.list.elems[n]);
str << " ";
}
str << "]";
@@ -107,13 +107,15 @@ static void printValue(std::ostream & str, std::set<const
Value *> & seen, const
default:
throw Error("invalid value");
}
+
+ active.erase(&v);
}
std::ostream & operator << (std::ostream & str, const Value & v)
{
- std::set<const Value *> seen;
- printValue(str, seen, v);
+ std::set<const Value *> active;
+ printValue(str, active, v);
return str;
}
- 227/376: Updated documentation for nix-install-package to mention --set flag, (continued)
- 227/376: Updated documentation for nix-install-package to mention --set flag, Ludovic Courtès, 2015/01/28
- 228/376: Fix use of PAGER during tests, Ludovic Courtès, 2015/01/28
- 221/376: Remove release notes Hydra product, Ludovic Courtès, 2015/01/28
- 218/376: Make forceValueDeep work on values with cycles, Ludovic Courtès, 2015/01/28
- 229/376: Remove bash requirement, Ludovic Courtès, 2015/01/28
- 231/376: nix-daemon: Close unnecessary fd, Ludovic Courtès, 2015/01/28
- 230/376: Bindings: Remove copy constructor, Ludovic Courtès, 2015/01/28
- 222/376: Add missing static, Ludovic Courtès, 2015/01/28
- 223/376: manual: add a note that lists are strict in length, Ludovic Courtès, 2015/01/28
- 232/376: printMissing(): Print derivations in approximate build order, Ludovic Courtès, 2015/01/28
- 234/376: printValue(): Don't print <CYCLE> for repeated values,
Ludovic Courtès <=
- 233/376: Support control characters in JSON output, Ludovic Courtès, 2015/01/28
- 235/376: createDirs(): Handle ‘path’ being a symlink, Ludovic Courtès, 2015/01/28
- 238/376: Add test for readDir primop, Ludovic Courtès, 2015/01/28
- 240/376: Remove some duplicate code, Ludovic Courtès, 2015/01/28
- 239/376: Add readDir primop, Ludovic Courtès, 2015/01/28
- 224/376: add manpage for nix-generate-patches, Ludovic Courtès, 2015/01/28
- 246/376: Typo, Ludovic Courtès, 2015/01/28
- 245/376: Get rid of some unnecessary ExprConcatStrings nodes in dynamic attrs, Ludovic Courtès, 2015/01/28
- 243/376: Add primop ‘catAttrs’, Ludovic Courtès, 2015/01/28
- 249/376: nix-copy-closure: Use strict, Ludovic Courtès, 2015/01/28