about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nix-store/dotgraph.cc4
-rw-r--r--src/nix-store/dotgraph.hh2
-rw-r--r--src/nix-store/nix-store.cc14
-rw-r--r--src/nix-store/xmlgraph.cc4
-rw-r--r--src/nix-store/xmlgraph.hh2
5 files changed, 13 insertions, 13 deletions
diff --git a/src/nix-store/dotgraph.cc b/src/nix-store/dotgraph.cc
index 83472b0a3bc3..8735cf9b667b 100644
--- a/src/nix-store/dotgraph.cc
+++ b/src/nix-store/dotgraph.cc
@@ -94,7 +94,7 @@ void printClosure(const Path & nePath, const StoreExpr & fs)
 #endif
 
 
-void printDotGraph(Store & store, const PathSet & roots)
+void printDotGraph(ref<Store> store, const PathSet & roots)
 {
     PathSet workList(roots);
     PathSet doneSet;
@@ -111,7 +111,7 @@ void printDotGraph(Store & store, const PathSet & roots)
         cout << makeNode(path, symbolicName(path), "#ff0000");
 
         PathSet references;
-        store.queryReferences(path, references);
+        store->queryReferences(path, references);
 
         for (PathSet::iterator i = references.begin();
              i != references.end(); ++i)
diff --git a/src/nix-store/dotgraph.hh b/src/nix-store/dotgraph.hh
index d03c7d5b7a58..e2b5fc72fbe1 100644
--- a/src/nix-store/dotgraph.hh
+++ b/src/nix-store/dotgraph.hh
@@ -6,6 +6,6 @@ namespace nix {
 
 class Store;
 
-void printDotGraph(Store & store, const PathSet & roots);
+void printDotGraph(ref<Store> store, const PathSet & roots);
 
 }
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index b384ad2ab001..4e706f93c12f 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -40,11 +40,11 @@ static bool noOutput = false;
 static std::shared_ptr<Store> store;
 
 
-LocalStore & ensureLocalStore()
+ref<LocalStore> ensureLocalStore()
 {
-    LocalStore * store2(dynamic_cast<LocalStore *>(store.get()));
+    auto store2 = std::dynamic_pointer_cast<LocalStore>(store);
     if (!store2) throw Error("you don't have sufficient rights to use this command");
-    return *store2;
+    return ref<LocalStore>(store2);
 }
 
 
@@ -395,7 +395,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
                 PathSet paths = maybeUseOutputs(followLinksToStorePath(i), useOutput, forceRealise);
                 roots.insert(paths.begin(), paths.end());
             }
-            printDotGraph(*store, roots);
+            printDotGraph(ref<Store>(store), roots);
             break;
         }
 
@@ -405,7 +405,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
                 PathSet paths = maybeUseOutputs(followLinksToStorePath(i), useOutput, forceRealise);
                 roots.insert(paths.begin(), paths.end());
             }
-            printXmlGraph(*store, roots);
+            printXmlGraph(ref<Store>(store), roots);
             break;
         }
 
@@ -574,7 +574,7 @@ static void registerValidity(bool reregister, bool hashGiven, bool canonicalise)
         }
     }
 
-    ensureLocalStore().registerValidPaths(infos);
+    ensureLocalStore()->registerValidPaths(infos);
 }
 
 
@@ -805,7 +805,7 @@ static void opRepairPath(Strings opFlags, Strings opArgs)
 
     for (auto & i : opArgs) {
         Path path = followLinksToStorePath(i);
-        ensureLocalStore().repairPath(path);
+        ensureLocalStore()->repairPath(path);
     }
 }
 
diff --git a/src/nix-store/xmlgraph.cc b/src/nix-store/xmlgraph.cc
index ccb218408a8a..b6e1c1c4b873 100644
--- a/src/nix-store/xmlgraph.cc
+++ b/src/nix-store/xmlgraph.cc
@@ -33,7 +33,7 @@ static string makeNode(const string & id)
 }
 
 
-void printXmlGraph(Store & store, const PathSet & roots)
+void printXmlGraph(ref<Store> store, const PathSet & roots)
 {
     PathSet workList(roots);
     PathSet doneSet;
@@ -51,7 +51,7 @@ void printXmlGraph(Store & store, const PathSet & roots)
         cout << makeNode(path);
 
         PathSet references;
-        store.queryReferences(path, references);
+        store->queryReferences(path, references);
 
         for (PathSet::iterator i = references.begin();
              i != references.end(); ++i)
diff --git a/src/nix-store/xmlgraph.hh b/src/nix-store/xmlgraph.hh
index 6454d3a28d16..a6e7d4e2805a 100644
--- a/src/nix-store/xmlgraph.hh
+++ b/src/nix-store/xmlgraph.hh
@@ -6,6 +6,6 @@ namespace nix {
 
 class Store;
 
-void printXmlGraph(Store & store, const PathSet & roots);
+void printXmlGraph(ref<Store> store, const PathSet & roots);
 
 }