diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-19T17·55+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-19T17·55+0100 |
commit | 867055133d3f487e52dd44149f76347c2c28bf10 (patch) | |
tree | c367803ad94f024b0052727a2c7a037af169169a /third_party/nix/src/resolve-system-dependencies | |
parent | c6a31838cd7e88ebcb01422b329a499d04ab4b6b (diff) |
style(3p/nix): Add braces around single-line conditionals r/771
These were not caught by the previous clang-tidy invocation, but were instead sorted out using amber[0] as such: ambr --regex 'if (\(.+\))\s([a-z].*;)' 'if $1 { $2 }' [0]: https://github.com/dalance/amber
Diffstat (limited to 'third_party/nix/src/resolve-system-dependencies')
-rw-r--r-- | third_party/nix/src/resolve-system-dependencies/resolve-system-dependencies.cc | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/third_party/nix/src/resolve-system-dependencies/resolve-system-dependencies.cc b/third_party/nix/src/resolve-system-dependencies/resolve-system-dependencies.cc index f6c01e3ec184..7bdb417f621d 100644 --- a/third_party/nix/src/resolve-system-dependencies/resolve-system-dependencies.cc +++ b/third_party/nix/src/resolve-system-dependencies/resolve-system-dependencies.cc @@ -30,10 +30,14 @@ std::set<string> readCacheFile(const Path& file) { std::set<std::string> runResolver(const Path& filename) { AutoCloseFD fd = open(filename.c_str(), O_RDONLY); - if (!fd) throw SysError("opening '%s'", filename); + if (!fd) { + throw SysError("opening '%s'", filename); + } struct stat st; - if (fstat(fd.get(), &st)) throw SysError("statting '%s'", filename); + if (fstat(fd.get(), &st)) { + throw SysError("statting '%s'", filename); + } if (!S_ISREG(st.st_mode)) { printError("file '%s' is not a regular file", filename); @@ -46,7 +50,9 @@ std::set<std::string> runResolver(const Path& filename) { } char* obj = (char*)mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd.get(), 0); - if (!obj) throw SysError("mmapping '%s'", filename); + if (!obj) { + throw SysError("mmapping '%s'", filename); + } ptrdiff_t mach64_offset = 0; @@ -115,7 +121,9 @@ Path resolveSymlink(const Path& path) { std::set<string> resolveTree(const Path& path, PathSet& deps) { std::set<string> results; - if (deps.count(path)) return {}; + if (deps.count(path)) { + return {}; + } deps.insert(path); for (auto& lib : runResolver(path)) { results.insert(lib); @@ -127,10 +135,14 @@ std::set<string> resolveTree(const Path& path, PathSet& deps) { } std::set<string> getPath(const Path& path) { - if (hasPrefix(path, "/dev")) return {}; + if (hasPrefix(path, "/dev")) { + return {}; + } Path cacheFile = resolveCacheFile(path); - if (pathExists(cacheFile)) return readCacheFile(cacheFile); + if (pathExists(cacheFile)) { + return readCacheFile(cacheFile); + } std::set<string> deps, paths; paths.insert(path); |