about summary refs log tree commit diff
path: root/src/libexpr/names.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr/names.cc')
-rw-r--r--src/libexpr/names.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libexpr/names.cc b/src/libexpr/names.cc
index c2b2733347f6..cda5aa1952ea 100644
--- a/src/libexpr/names.cc
+++ b/src/libexpr/names.cc
@@ -1,6 +1,5 @@
 #include "names.hh"
 #include "util.hh"
-#include "regex.hh"
 
 
 namespace nix {
@@ -34,8 +33,8 @@ DrvName::DrvName(const string & s) : hits(0)
 bool DrvName::matches(DrvName & n)
 {
     if (name != "*") {
-        Regex regex(name);
-        if (!regex.matches(n.name)) return false;
+        if (!regex) regex = std::shared_ptr<Regex>(new Regex(name));
+        if (!regex->matches(n.name)) return false;
     }
     if (version != "" && version != n.version) return false;
     return true;