[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
212/376: attrNames: Don't allocate duplicates of the symbols
From: |
Ludovic Courtès |
Subject: |
212/376: attrNames: Don't allocate duplicates of the symbols |
Date: |
Wed, 28 Jan 2015 22:05:07 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit 2d6cd8aafdc40194497af4ed924a890f6d0a92aa
Author: Eelco Dolstra <address@hidden>
Date: Fri Sep 19 18:11:46 2014 +0200
attrNames: Don't allocate duplicates of the symbols
---
src/libexpr/primops.cc | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index a5bac3f..66321c7 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -914,13 +914,11 @@ static void prim_attrNames(EvalState & state, const Pos &
pos, Value * * args, V
state.mkList(v, args[0]->attrs->size());
- StringSet names;
- foreach (Bindings::iterator, i, *args[0]->attrs)
- names.insert(i->name);
-
unsigned int n = 0;
- foreach (StringSet::iterator, i, names)
- mkString(*(v.list.elems[n++] = state.allocValue()), *i);
+ for (auto & i : *args[0]->attrs)
+ mkString(*(v.list.elems[n++] = state.allocValue()), i.name);
+
+ std::sort(v.list.elems, v.list.elems + n, [](Value * v1, Value * v2) {
return strcmp(v1->string.s, v2->string.s) < 0; });
}
- 182/376: Merge branch 'master' of github.com:thatdocslady/nix, (continued)
- 182/376: Merge branch 'master' of github.com:thatdocslady/nix, Ludovic Courtès, 2015/01/28
- 207/376: Remove debug statement, Ludovic Courtès, 2015/01/28
- 204/376: Install some pkgconfig files, Ludovic Courtès, 2015/01/28
- 206/376: Store.so: Add dependency on libnixutil, Ludovic Courtès, 2015/01/28
- 200/376: Add some instrumentation for debugging GC leaks, Ludovic Courtès, 2015/01/28
- 210/376: Inline Bindings::find(), Ludovic Courtès, 2015/01/28
- 202/376: On Linux, disable address space randomization, Ludovic Courtès, 2015/01/28
- 205/376: Update spec file, Ludovic Courtès, 2015/01/28
- 201/376: Add Make flag to disable optimization, Ludovic Courtès, 2015/01/28
- 213/376: configure: Force regeneration of Makefile.config, Ludovic Courtès, 2015/01/28
- 212/376: attrNames: Don't allocate duplicates of the symbols,
Ludovic Courtès <=
- 216/376: Handle cycles when printing a value, Ludovic Courtès, 2015/01/28
- 211/376: Fix off-by-one, Ludovic Courtès, 2015/01/28
- 215/376: Add ‘seq’ primop, Ludovic Courtès, 2015/01/28
- 209/376: Store Attrs inside Bindings, Ludovic Courtès, 2015/01/28
- 208/376: Remove bogus comment, Ludovic Courtès, 2015/01/28
- 219/376: Add ‘deepSeq’ primop, Ludovic Courtès, 2015/01/28
- 225/376: Pass through --set from nix-install-package command line to nix-env, Ludovic Courtès, 2015/01/28
- 214/376: Add a function ‘valueSize’, Ludovic Courtès, 2015/01/28
- 145/376: Use proper quotes everywhere, Ludovic Courtès, 2015/01/28
- 226/376: Add --force-name support for --set in nix-env, to support nix-install-package --set, Ludovic Courtès, 2015/01/28