From 93e4f01ee3ea33f47ade8530e5fa78346008ea6e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 19 Sep 2014 16:56:13 +0200 Subject: [PATCH] Inline Bindings::find() --- src/libexpr/eval.cc | 9 --------- src/libexpr/eval.hh | 9 ++++++++- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index b07d210c1..cf8aafa8f 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -32,15 +32,6 @@ namespace nix { -Bindings::iterator Bindings::find(const Symbol & name) -{ - Attr key(name, 0); - iterator i = std::lower_bound(begin(), end(), key); - if (i != end() && i->name == name) return i; - return end(); -} - - void Bindings::sort() { std::sort(begin(), end()); diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 3ac40ed34..dcd6209e3 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -57,7 +57,14 @@ public: attrs[size_++] = attr; } - iterator find(const Symbol & name); + iterator find(const Symbol & name) + { + Attr key(name, 0); + iterator i = std::lower_bound(begin(), end(), key); + if (i != end() && i->name == name) return i; + return end(); + } + iterator begin() { return &attrs[0]; } iterator end() { return &attrs[size_]; }