From 0f2cf531f705d370321843e5ba9135b2ebdb5d19 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 17 May 2020 16:31:57 +0100 Subject: style(3p/nix): Reformat project in Google C++ style Reformatted with: fd . -e hh -e cc | xargs clang-format -i --- third_party/nix/src/nix-store/graphml.cc | 128 ++++++++++++++----------------- 1 file changed, 57 insertions(+), 71 deletions(-) (limited to 'third_party/nix/src/nix-store/graphml.cc') diff --git a/third_party/nix/src/nix-store/graphml.cc b/third_party/nix/src/nix-store/graphml.cc index 670fbe227a..299468ab9d 100644 --- a/third_party/nix/src/nix-store/graphml.cc +++ b/third_party/nix/src/nix-store/graphml.cc @@ -1,90 +1,76 @@ #include "graphml.hh" -#include "util.hh" -#include "store-api.hh" -#include "derivations.hh" - #include - +#include "derivations.hh" +#include "store-api.hh" +#include "util.hh" using std::cout; namespace nix { - -static inline const string & xmlQuote(const string & s) -{ - // Luckily, store paths shouldn't contain any character that needs to be - // quoted. - return s; +static inline const string& xmlQuote(const string& s) { + // Luckily, store paths shouldn't contain any character that needs to be + // quoted. + return s; } - -static string symbolicName(const string & path) -{ - string p = baseNameOf(path); - return string(p, p.find('-') + 1); +static string symbolicName(const string& path) { + string p = baseNameOf(path); + return string(p, p.find('-') + 1); } - -static string makeEdge(const string & src, const string & dst) -{ - return fmt(" \n", - xmlQuote(src), xmlQuote(dst)); +static string makeEdge(const string& src, const string& dst) { + return fmt(" \n", xmlQuote(src), + xmlQuote(dst)); } - -static string makeNode(const ValidPathInfo & info) -{ - return fmt( - " \n" - " %2%\n" - " %3%\n" - " %4%\n" - " \n", - info.path, - info.narSize, - symbolicName(info.path), - (isDerivation(info.path) ? "derivation" : "output-path")); +static string makeNode(const ValidPathInfo& info) { + return fmt( + " \n" + " %2%\n" + " %3%\n" + " %4%\n" + " \n", + info.path, info.narSize, symbolicName(info.path), + (isDerivation(info.path) ? "derivation" : "output-path")); } - -void printGraphML(ref store, const PathSet & roots) -{ - PathSet workList(roots); - PathSet doneSet; - std::pair ret; - - cout << "\n" - << "\n" - << "" - << "" - << "" - << "\n"; - - while (!workList.empty()) { - Path path = *(workList.begin()); - workList.erase(path); - - ret = doneSet.insert(path); - if (ret.second == false) continue; - - ValidPathInfo info = *(store->queryPathInfo(path)); - cout << makeNode(info); - - for (auto & p : store->queryPathInfo(path)->references) { - if (p != path) { - workList.insert(p); - cout << makeEdge(path, p); - } - } - +void printGraphML(ref store, const PathSet& roots) { + PathSet workList(roots); + PathSet doneSet; + std::pair ret; + + cout << "\n" + << "\n" + << "" + << "" + << "" + << "\n"; + + while (!workList.empty()) { + Path path = *(workList.begin()); + workList.erase(path); + + ret = doneSet.insert(path); + if (ret.second == false) continue; + + ValidPathInfo info = *(store->queryPathInfo(path)); + cout << makeNode(info); + + for (auto& p : store->queryPathInfo(path)->references) { + if (p != path) { + workList.insert(p); + cout << makeEdge(path, p); + } } + } - cout << "\n"; - cout << "\n"; + cout << "\n"; + cout << "\n"; } - -} +} // namespace nix -- cgit 1.4.1