style(3p/nix): Add braces around single-line conditionals
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
This commit is contained in:
parent
c6a31838cd
commit
867055133d
97 changed files with 2223 additions and 753 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue