From afcdc7606cb9c1a1603a3a51b08ac411f82795db Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 21 Feb 2022 16:25:12 +0100 Subject: [PATCH 1/5] Remove std::list alias --- src/libexpr/get-drvs.hh | 4 ++-- src/libexpr/primops.cc | 4 ++-- src/libstore/names.hh | 2 +- src/libstore/pathlocks.hh | 2 +- src/libutil/types.hh | 5 ++--- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/libexpr/get-drvs.hh b/src/libexpr/get-drvs.hh index 29bb6a660..128354682 100644 --- a/src/libexpr/get-drvs.hh +++ b/src/libexpr/get-drvs.hh @@ -70,9 +70,9 @@ public: #if HAVE_BOEHMGC -typedef list > DrvInfos; +typedef std::list > DrvInfos; #else -typedef list DrvInfos; +typedef std::list DrvInfos; #endif diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index defb861e6..6f79fc49d 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -574,9 +574,9 @@ struct CompareValues #if HAVE_BOEHMGC -typedef list > ValueList; +typedef std::list > ValueList; #else -typedef list ValueList; +typedef std::list ValueList; #endif diff --git a/src/libstore/names.hh b/src/libstore/names.hh index 6f01fe2a1..ecbad10b3 100644 --- a/src/libstore/names.hh +++ b/src/libstore/names.hh @@ -25,7 +25,7 @@ private: std::unique_ptr regex; }; -typedef list DrvNames; +typedef std::list DrvNames; std::string_view nextComponent(std::string_view::const_iterator & p, const std::string_view::const_iterator end); diff --git a/src/libstore/pathlocks.hh b/src/libstore/pathlocks.hh index 919c8904c..759b9a584 100644 --- a/src/libstore/pathlocks.hh +++ b/src/libstore/pathlocks.hh @@ -20,7 +20,7 @@ class PathLocks { private: typedef std::pair FDPair; - list fds; + std::list fds; bool deletePaths; public: diff --git a/src/libutil/types.hh b/src/libutil/types.hh index e3aca20c9..130c04451 100644 --- a/src/libutil/types.hh +++ b/src/libutil/types.hh @@ -11,12 +11,11 @@ namespace nix { -using std::list; using std::set; using std::vector; using std::string; -typedef list Strings; +typedef std::list Strings; typedef set StringSet; typedef std::map StringMap; @@ -24,7 +23,7 @@ typedef std::map StringMap; typedef string Path; typedef std::string_view PathView; -typedef list Paths; +typedef std::list Paths; typedef set PathSet; typedef vector> Headers; From fe9afb65bb35737a144acd612170b2e284298a2f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 21 Feb 2022 16:28:23 +0100 Subject: [PATCH 2/5] Remove std::set alias --- src/libexpr/get-drvs.cc | 2 +- src/libexpr/primops.cc | 2 +- src/libstore/build/derivation-goal.cc | 2 +- src/libstore/build/goal.hh | 4 ++-- src/libstore/build/worker.cc | 4 ++-- src/libstore/build/worker.hh | 4 ++-- src/libstore/local-store.hh | 2 +- src/libutil/types.hh | 5 ++--- src/libutil/util.cc | 2 +- src/libutil/util.hh | 2 +- src/nix/repl.cc | 2 +- 11 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/libexpr/get-drvs.cc b/src/libexpr/get-drvs.cc index 5995a857b..167fb5fa9 100644 --- a/src/libexpr/get-drvs.cc +++ b/src/libexpr/get-drvs.cc @@ -266,7 +266,7 @@ void DrvInfo::setMeta(const string & name, Value * v) /* Cache for already considered attrsets. */ -typedef set Done; +typedef std::set Done; /* Evaluate value `v'. If it evaluates to a set of type `derivation', diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 6f79fc49d..44f0b19bc 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -654,7 +654,7 @@ static void prim_genericClosure(EvalState & state, const Pos & pos, Value * * ar // `doneKeys' doesn't need to be a GC root, because its values are // reachable from res. auto cmp = CompareValues(state); - set doneKeys(cmp); + std::set doneKeys(cmp); while (!workSet.empty()) { Value * e = *(workSet.begin()); workSet.pop_front(); diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index 151217b8b..27f8c6257 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -1091,7 +1091,7 @@ HookReply DerivationGoal::tryBuildHook() /* Create the log file and pipe. */ Path logFile = openLogFile(); - set fds; + std::set fds; fds.insert(hook->fromHook.readSide.get()); fds.insert(hook->builderOut.readSide.get()); worker.childStarted(shared_from_this(), fds, false, false); diff --git a/src/libstore/build/goal.hh b/src/libstore/build/goal.hh index 192e416d2..0db0c1938 100644 --- a/src/libstore/build/goal.hh +++ b/src/libstore/build/goal.hh @@ -18,8 +18,8 @@ struct CompareGoalPtrs { }; /* Set of goals. */ -typedef set Goals; -typedef set> WeakGoals; +typedef std::set Goals; +typedef std::set> WeakGoals; /* A map of paths to goals (and the other way around). */ typedef std::map WeakGoalMap; diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index f11c5ce68..0a6108233 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -161,7 +161,7 @@ unsigned Worker::getNrLocalBuilds() } -void Worker::childStarted(GoalPtr goal, const set & fds, +void Worker::childStarted(GoalPtr goal, const std::set & fds, bool inBuildSlot, bool respectTimeouts) { Child child; @@ -377,7 +377,7 @@ void Worker::waitForInput() GoalPtr goal = j->goal.lock(); assert(goal); - set fds2(j->fds); + std::set fds2(j->fds); std::vector buffer(4096); for (auto & k : fds2) { if (pollStatus.at(fdToPollStatus.at(k)).revents) { diff --git a/src/libstore/build/worker.hh b/src/libstore/build/worker.hh index 6a3b99c02..a1e036a96 100644 --- a/src/libstore/build/worker.hh +++ b/src/libstore/build/worker.hh @@ -38,7 +38,7 @@ struct Child { WeakGoalPtr goal; Goal * goal2; // ugly hackery - set fds; + std::set fds; bool respectTimeouts; bool inBuildSlot; steady_time_point lastOutput; /* time we last got output on stdout/stderr */ @@ -167,7 +167,7 @@ public: /* Registers a running child process. `inBuildSlot' means that the process counts towards the jobs limit. */ - void childStarted(GoalPtr goal, const set & fds, + void childStarted(GoalPtr goal, const std::set & fds, bool inBuildSlot, bool respectTimeouts); /* Unregisters a running child process. `wakeSleepers' should be diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh index 46aed9bcb..a9c7475ac 100644 --- a/src/libstore/local-store.hh +++ b/src/libstore/local-store.hh @@ -292,7 +292,7 @@ private: typedef std::pair Inode; -typedef set InodesSeen; +typedef std::set InodesSeen; /* "Fix", or canonicalise, the meta-data of the files in a store path diff --git a/src/libutil/types.hh b/src/libutil/types.hh index 130c04451..057c9021c 100644 --- a/src/libutil/types.hh +++ b/src/libutil/types.hh @@ -11,12 +11,11 @@ namespace nix { -using std::set; using std::vector; using std::string; typedef std::list Strings; -typedef set StringSet; +typedef std::set StringSet; typedef std::map StringMap; /* Paths are just strings. */ @@ -24,7 +23,7 @@ typedef std::map StringMap; typedef string Path; typedef std::string_view PathView; typedef std::list Paths; -typedef set PathSet; +typedef std::set PathSet; typedef vector> Headers; diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 9c2e43cdd..b6041264e 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -1174,7 +1174,7 @@ void runProgram2(const RunOptions & options) } -void closeMostFDs(const set & exceptions) +void closeMostFDs(const std::set & exceptions) { #if __linux__ try { diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 579a42785..319442210 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -343,7 +343,7 @@ std::vector stringsToCharPtrs(const Strings & ss); /* Close all file descriptors except those listed in the given set. Good practice in child processes. */ -void closeMostFDs(const set & exceptions); +void closeMostFDs(const std::set & exceptions); /* Set the close-on-exec flag for the given file descriptor. */ void closeOnExec(int fd); diff --git a/src/nix/repl.cc b/src/nix/repl.cc index 2c39fac91..60454471d 100644 --- a/src/nix/repl.cc +++ b/src/nix/repl.cc @@ -75,7 +75,7 @@ struct NixRepl Expr * parseString(string s); void evalString(string s, Value & v); - typedef set ValuesSeen; + typedef std::set ValuesSeen; std::ostream & printValue(std::ostream & str, Value & v, unsigned int maxDepth); std::ostream & printValue(std::ostream & str, Value & v, unsigned int maxDepth, ValuesSeen & seen); }; From 1ac2664472d0135503e54f0d924a802023855003 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 21 Feb 2022 16:32:34 +0100 Subject: [PATCH 3/5] Remove std::vector alias --- src/build-remote/build-remote.cc | 2 +- src/libexpr/nixexpr.hh | 4 ++-- src/libexpr/parser.y | 16 ++++++++-------- src/libexpr/primops.cc | 4 ++-- src/libutil/config.cc | 4 ++-- src/libutil/types.hh | 3 +-- src/libutil/util.cc | 2 +- src/libutil/util.hh | 2 +- src/nix-env/nix-env.cc | 6 +++--- 9 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index 9d541b45d..4d7b602d8 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -208,7 +208,7 @@ static int main_build_remote(int argc, char * * argv) for (auto & m : machines) error - % concatStringsSep>(", ", m.systemTypes) + % concatStringsSep>(", ", m.systemTypes) % m.maxJobs % concatStringsSep(", ", m.supportedFeatures) % concatStringsSep(", ", m.mandatoryFeatures); diff --git a/src/libexpr/nixexpr.hh b/src/libexpr/nixexpr.hh index 6f6acb074..e7f717eba 100644 --- a/src/libexpr/nixexpr.hh +++ b/src/libexpr/nixexpr.hh @@ -335,8 +335,8 @@ struct ExprConcatStrings : Expr { Pos pos; bool forceString; - vector > * es; - ExprConcatStrings(const Pos & pos, bool forceString, vector > * es) + std::vector > * es; + ExprConcatStrings(const Pos & pos, bool forceString, std::vector > * es) : pos(pos), forceString(forceString), es(es) { }; COMMON_METHODS }; diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index f0c80ebd5..e1d177c1f 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -193,7 +193,7 @@ static Formals * toFormals(ParseData & data, ParserFormals * formals, static Expr * stripIndentation(const Pos & pos, SymbolTable & symbols, - vector > > & es) + std::vector > > & es) { if (es.empty()) return new ExprString(""); @@ -233,7 +233,7 @@ static Expr * stripIndentation(const Pos & pos, SymbolTable & symbols, } /* Strip spaces from each line. */ - vector > * es2 = new vector >; + std::vector > * es2 = new std::vector >; atStartOfLine = true; size_t curDropped = 0; size_t n = es.size(); @@ -415,7 +415,7 @@ expr_op | expr_op UPDATE expr_op { $$ = new ExprOpUpdate(CUR_POS, $1, $3); } | expr_op '?' attrpath { $$ = new ExprOpHasAttr($1, *$3); } | expr_op '+' expr_op - { $$ = new ExprConcatStrings(CUR_POS, false, new vector >({{makeCurPos(@1, data), $1}, {makeCurPos(@3, data), $3}})); } + { $$ = new ExprConcatStrings(CUR_POS, false, new std::vector >({{makeCurPos(@1, data), $1}, {makeCurPos(@3, data), $3}})); } | expr_op '-' expr_op { $$ = new ExprCall(CUR_POS, new ExprVar(data->symbols.create("__sub")), {$1, $3}); } | expr_op '*' expr_op { $$ = new ExprCall(CUR_POS, new ExprVar(data->symbols.create("__mul")), {$1, $3}); } | expr_op '/' expr_op { $$ = new ExprCall(CUR_POS, new ExprVar(data->symbols.create("__div")), {$1, $3}); } @@ -503,9 +503,9 @@ string_parts_interpolated : string_parts_interpolated STR { $$ = $1; $1->emplace_back(makeCurPos(@2, data), new ExprString(string($2))); } | string_parts_interpolated DOLLAR_CURLY expr '}' { $$ = $1; $1->emplace_back(makeCurPos(@2, data), $3); } - | DOLLAR_CURLY expr '}' { $$ = new vector >; $$->emplace_back(makeCurPos(@1, data), $2); } + | DOLLAR_CURLY expr '}' { $$ = new std::vector >; $$->emplace_back(makeCurPos(@1, data), $2); } | STR DOLLAR_CURLY expr '}' { - $$ = new vector >; + $$ = new std::vector >; $$->emplace_back(makeCurPos(@1, data), new ExprString(string($1))); $$->emplace_back(makeCurPos(@2, data), $3); } @@ -528,7 +528,7 @@ path_start ind_string_parts : ind_string_parts IND_STR { $$ = $1; $1->emplace_back(makeCurPos(@2, data), $2); } | ind_string_parts DOLLAR_CURLY expr '}' { $$ = $1; $1->emplace_back(makeCurPos(@2, data), $3); } - | { $$ = new vector > >; } + | { $$ = new std::vector > >; } ; binds @@ -582,9 +582,9 @@ attrpath } else $$->push_back(AttrName($3)); } - | attr { $$ = new vector; $$->push_back(AttrName(data->symbols.create($1))); } + | attr { $$ = new std::vector; $$->push_back(AttrName(data->symbols.create($1))); } | string_attr - { $$ = new vector; + { $$ = new std::vector; ExprString *str = dynamic_cast($1); if (str) { $$->push_back(AttrName(data->symbols.create(str->s))); diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 44f0b19bc..daf679a5a 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -3649,12 +3649,12 @@ static void prim_replaceStrings(EvalState & state, const Pos & pos, Value * * ar .errPos = pos }); - vector from; + std::vector from; from.reserve(args[0]->listSize()); for (auto elem : args[0]->listItems()) from.emplace_back(state.forceString(*elem, pos)); - vector> to; + std::vector> to; to.reserve(args[1]->listSize()); for (auto elem : args[1]->listItems()) { PathSet ctx; diff --git a/src/libutil/config.cc b/src/libutil/config.cc index 92ab265d3..8e05f1765 100644 --- a/src/libutil/config.cc +++ b/src/libutil/config.cc @@ -90,7 +90,7 @@ void AbstractConfig::applyConfig(const std::string & contents, const std::string if (hash != string::npos) line = string(line, 0, hash); - vector tokens = tokenizeString >(line); + auto tokens = tokenizeString>(line); if (tokens.empty()) continue; if (tokens.size() < 2) @@ -122,7 +122,7 @@ void AbstractConfig::applyConfig(const std::string & contents, const std::string string name = tokens[0]; - vector::iterator i = tokens.begin(); + auto i = tokens.begin(); advance(i, 2); set(name, concatStringsSep(" ", Strings(i, tokens.end()))); // FIXME: slow diff --git a/src/libutil/types.hh b/src/libutil/types.hh index 057c9021c..a26c9a966 100644 --- a/src/libutil/types.hh +++ b/src/libutil/types.hh @@ -11,7 +11,6 @@ namespace nix { -using std::vector; using std::string; typedef std::list Strings; @@ -25,7 +24,7 @@ typedef std::string_view PathView; typedef std::list Paths; typedef std::set PathSet; -typedef vector> Headers; +typedef std::vector> Headers; /* Helper class to run code at startup. */ template diff --git a/src/libutil/util.cc b/src/libutil/util.cc index b6041264e..b172e0554 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -1250,7 +1250,7 @@ template C tokenizeString(std::string_view s, std::string_view separato template Strings tokenizeString(std::string_view s, std::string_view separators); template StringSet tokenizeString(std::string_view s, std::string_view separators); -template vector tokenizeString(std::string_view s, std::string_view separators); +template std::vector tokenizeString(std::string_view s, std::string_view separators); string chomp(std::string_view s) diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 319442210..a949e6424 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -99,7 +99,7 @@ struct DirEntry : name(name), ino(ino), type(type) { } }; -typedef vector DirEntries; +typedef std::vector DirEntries; DirEntries readDirectory(const Path & path); diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc index d2636abf7..52d07e3df 100644 --- a/src/nix-env/nix-env.cc +++ b/src/nix-env/nix-env.cc @@ -840,7 +840,7 @@ void printTable(Table & table) { auto nrColumns = table.size() > 0 ? table.front().size() : 0; - vector widths; + std::vector widths; widths.resize(nrColumns); for (auto & i : table) { @@ -907,7 +907,7 @@ static VersionDiff compareVersionAgainstSet( } -static void queryJSON(Globals & globals, vector & elems, bool printOutPath, bool printMeta) +static void queryJSON(Globals & globals, std::vector & elems, bool printOutPath, bool printMeta) { JSONObject topObj(cout, true); for (auto & i : elems) { @@ -1020,7 +1020,7 @@ static void opQuery(Globals & globals, Strings opFlags, Strings opArgs) /* Sort them by name. */ /* !!! */ - vector elems; + std::vector elems; for (auto & i : elems_) elems.push_back(i); sort(elems.begin(), elems.end(), cmpElemByName); From 36c7b12f3354606a50808197f6695c185fd02893 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 21 Feb 2022 16:37:25 +0100 Subject: [PATCH 4/5] Remove std::string alias --- src/libexpr/symbol-table.hh | 8 ++++---- src/libexpr/value.hh | 10 +++++----- src/libstore/machines.hh | 14 +++++++------- src/libstore/names.hh | 6 +++--- src/libutil/types.hh | 13 +++++-------- 5 files changed, 24 insertions(+), 27 deletions(-) diff --git a/src/libexpr/symbol-table.hh b/src/libexpr/symbol-table.hh index a090ebae5..48d20c29d 100644 --- a/src/libexpr/symbol-table.hh +++ b/src/libexpr/symbol-table.hh @@ -17,8 +17,8 @@ namespace nix { class Symbol { private: - const string * s; // pointer into SymbolTable - Symbol(const string * s) : s(s) { }; + const std::string * s; // pointer into SymbolTable + Symbol(const std::string * s) : s(s) { }; friend class SymbolTable; public: @@ -72,7 +72,7 @@ class SymbolTable { private: std::unordered_map symbols; - std::list store; + std::list store; public: Symbol create(std::string_view s) @@ -84,7 +84,7 @@ public: auto it = symbols.find(s); if (it != symbols.end()) return it->second; - const string & rawSym = store.emplace_back(s); + auto & rawSym = store.emplace_back(s); return symbols.emplace(rawSym, Symbol(&rawSym)).first->second; } diff --git a/src/libexpr/value.hh b/src/libexpr/value.hh index bef5cd6bd..3fdff71a5 100644 --- a/src/libexpr/value.hh +++ b/src/libexpr/value.hh @@ -77,20 +77,20 @@ class ExternalValueBase public: /* Return a simple string describing the type */ - virtual string showType() const = 0; + virtual std::string showType() const = 0; /* Return a string to be used in builtins.typeOf */ - virtual string typeOf() const = 0; + virtual std::string typeOf() const = 0; /* Coerce the value to a string. Defaults to uncoercable, i.e. throws an - * error + * error. */ - virtual string coerceToString(const Pos & pos, PathSet & context, bool copyMore, bool copyToStore) const; + virtual std::string coerceToString(const Pos & pos, PathSet & context, bool copyMore, bool copyToStore) const; /* Compare to another value of the same type. Defaults to uncomparable, * i.e. always false. */ - virtual bool operator==(const ExternalValueBase & b) const; + virtual bool operator ==(const ExternalValueBase & b) const; /* Print the value as JSON. Defaults to unconvertable, i.e. throws an error */ virtual void printValueAsJSON(EvalState & state, bool strict, diff --git a/src/libstore/machines.hh b/src/libstore/machines.hh index 341d9bd97..834626de9 100644 --- a/src/libstore/machines.hh +++ b/src/libstore/machines.hh @@ -8,19 +8,19 @@ class Store; struct Machine { - const string storeUri; - const std::vector systemTypes; - const string sshKey; + const std::string storeUri; + const std::vector systemTypes; + const std::string sshKey; const unsigned int maxJobs; const unsigned int speedFactor; - const std::set supportedFeatures; - const std::set mandatoryFeatures; + const std::set supportedFeatures; + const std::set mandatoryFeatures; const std::string sshPublicHostKey; bool enabled = true; - bool allSupported(const std::set & features) const; + bool allSupported(const std::set & features) const; - bool mandatoryMet(const std::set & features) const; + bool mandatoryMet(const std::set & features) const; Machine(decltype(storeUri) storeUri, decltype(systemTypes) systemTypes, diff --git a/src/libstore/names.hh b/src/libstore/names.hh index ecbad10b3..3977fc6cc 100644 --- a/src/libstore/names.hh +++ b/src/libstore/names.hh @@ -10,9 +10,9 @@ struct Regex; struct DrvName { - string fullName; - string name; - string version; + std::string fullName; + std::string name; + std::string version; unsigned int hits; DrvName(); diff --git a/src/libutil/types.hh b/src/libutil/types.hh index a26c9a966..bea2673ca 100644 --- a/src/libutil/types.hh +++ b/src/libutil/types.hh @@ -11,20 +11,17 @@ namespace nix { -using std::string; - -typedef std::list Strings; -typedef std::set StringSet; -typedef std::map StringMap; +typedef std::list Strings; +typedef std::set StringSet; +typedef std::map StringMap; /* Paths are just strings. */ - -typedef string Path; +typedef std::string Path; typedef std::string_view PathView; typedef std::list Paths; typedef std::set PathSet; -typedef std::vector> Headers; +typedef std::vector> Headers; /* Helper class to run code at startup. */ template From 8ffb09a08a375e19208bbe65ba532ce1e462b74e Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 21 Feb 2022 17:14:22 +0100 Subject: [PATCH 5/5] Fix macOS build --- .../resolve-system-dependencies.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/resolve-system-dependencies/resolve-system-dependencies.cc b/src/resolve-system-dependencies/resolve-system-dependencies.cc index 98c969437..4dd691981 100644 --- a/src/resolve-system-dependencies/resolve-system-dependencies.cc +++ b/src/resolve-system-dependencies/resolve-system-dependencies.cc @@ -23,9 +23,9 @@ Path resolveCacheFile(Path lib) return cacheDir + "/" + lib; } -std::set readCacheFile(const Path & file) +std::set readCacheFile(const Path & file) { - return tokenizeString>(readFile(file), "\n"); + return tokenizeString>(readFile(file), "\n"); } std::set runResolver(const Path & filename) @@ -81,7 +81,7 @@ std::set runResolver(const Path & filename) bool should_swap = magic == MH_CIGAM_64; ptrdiff_t cmd_offset = mach64_offset + sizeof(mach_header_64); - std::set libs; + std::set libs; for (uint32_t i = 0; i < DO_SWAP(should_swap, m_header->ncmds); i++) { load_command * cmd = (load_command *) (obj + cmd_offset); switch(DO_SWAP(should_swap, cmd->cmd)) { @@ -110,9 +110,9 @@ Path resolveSymlink(const Path & path) : concatStrings(dirOf(path), "/", target); } -std::set resolveTree(const Path & path, PathSet & deps) +std::set resolveTree(const Path & path, PathSet & deps) { - std::set results; + std::set results; if (!deps.insert(path).second) return {}; for (auto & lib : runResolver(path)) { results.insert(lib); @@ -123,7 +123,7 @@ std::set resolveTree(const Path & path, PathSet & deps) return results; } -std::set getPath(const Path & path) +std::set getPath(const Path & path) { if (hasPrefix(path, "/dev")) return {}; @@ -131,7 +131,7 @@ std::set getPath(const Path & path) if (pathExists(cacheFile)) return readCacheFile(cacheFile); - std::set deps, paths; + std::set deps, paths; paths.insert(path); Path nextPath(path); @@ -180,7 +180,7 @@ int main(int argc, char ** argv) impurePaths.insert("/usr/lib/libSystem.dylib"); } - std::set allPaths; + std::set allPaths; for (auto & path : impurePaths) for (auto & p : getPath(path))