More of the same

This commit is contained in:
Eelco Dolstra 2016-02-04 15:10:47 +01:00
parent fa7cd5369b
commit c780c1124e
5 changed files with 13 additions and 13 deletions

View file

@ -94,7 +94,7 @@ void printClosure(const Path & nePath, const StoreExpr & fs)
#endif #endif
void printDotGraph(Store & store, const PathSet & roots) void printDotGraph(ref<Store> store, const PathSet & roots)
{ {
PathSet workList(roots); PathSet workList(roots);
PathSet doneSet; PathSet doneSet;
@ -111,7 +111,7 @@ void printDotGraph(Store & store, const PathSet & roots)
cout << makeNode(path, symbolicName(path), "#ff0000"); cout << makeNode(path, symbolicName(path), "#ff0000");
PathSet references; PathSet references;
store.queryReferences(path, references); store->queryReferences(path, references);
for (PathSet::iterator i = references.begin(); for (PathSet::iterator i = references.begin();
i != references.end(); ++i) i != references.end(); ++i)

View file

@ -6,6 +6,6 @@ namespace nix {
class Store; class Store;
void printDotGraph(Store & store, const PathSet & roots); void printDotGraph(ref<Store> store, const PathSet & roots);
} }

View file

@ -40,11 +40,11 @@ static bool noOutput = false;
static std::shared_ptr<Store> store; 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"); 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); PathSet paths = maybeUseOutputs(followLinksToStorePath(i), useOutput, forceRealise);
roots.insert(paths.begin(), paths.end()); roots.insert(paths.begin(), paths.end());
} }
printDotGraph(*store, roots); printDotGraph(ref<Store>(store), roots);
break; break;
} }
@ -405,7 +405,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
PathSet paths = maybeUseOutputs(followLinksToStorePath(i), useOutput, forceRealise); PathSet paths = maybeUseOutputs(followLinksToStorePath(i), useOutput, forceRealise);
roots.insert(paths.begin(), paths.end()); roots.insert(paths.begin(), paths.end());
} }
printXmlGraph(*store, roots); printXmlGraph(ref<Store>(store), roots);
break; 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) { for (auto & i : opArgs) {
Path path = followLinksToStorePath(i); Path path = followLinksToStorePath(i);
ensureLocalStore().repairPath(path); ensureLocalStore()->repairPath(path);
} }
} }

View file

@ -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 workList(roots);
PathSet doneSet; PathSet doneSet;
@ -51,7 +51,7 @@ void printXmlGraph(Store & store, const PathSet & roots)
cout << makeNode(path); cout << makeNode(path);
PathSet references; PathSet references;
store.queryReferences(path, references); store->queryReferences(path, references);
for (PathSet::iterator i = references.begin(); for (PathSet::iterator i = references.begin();
i != references.end(); ++i) i != references.end(); ++i)

View file

@ -6,6 +6,6 @@ namespace nix {
class Store; class Store;
void printXmlGraph(Store & store, const PathSet & roots); void printXmlGraph(ref<Store> store, const PathSet & roots);
} }