style(tvix): Add missing braces in expressions
The previous clang-tidy invocation missed some header files, which has now been rectified. Change-Id: I31547754fbf52f439dc7aeefb08ab90bd50c4156 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1831 Reviewed-by: glittershark <grfn@gws.fyi> Tested-by: BuildkiteCI
This commit is contained in:
parent
7edbe59c6c
commit
1443298657
16 changed files with 132 additions and 72 deletions
3
third_party/nix/src/libutil/args.hh
vendored
3
third_party/nix/src/libutil/args.hh
vendored
|
|
@ -181,9 +181,10 @@ class Args {
|
|||
.arity(1)
|
||||
.handler([=](std::vector<std::string> ss) {
|
||||
I n;
|
||||
if (!absl::SimpleAtoi(ss[0], &n))
|
||||
if (!absl::SimpleAtoi(ss[0], &n)) {
|
||||
throw UsageError("flag '--%s' requires a integer argument",
|
||||
longName);
|
||||
}
|
||||
fun(n);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
12
third_party/nix/src/libutil/hash.cc
vendored
12
third_party/nix/src/libutil/hash.cc
vendored
|
|
@ -111,9 +111,15 @@ static std::string printHash16(const Hash& hash) {
|
|||
|
||||
bool Hash::IsValidBase16(absl::string_view s) {
|
||||
for (char c : s) {
|
||||
if ('0' <= c && c <= '9') continue;
|
||||
if ('a' <= c && c <= 'f') continue;
|
||||
if ('A' <= c && c <= 'F') continue;
|
||||
if ('0' <= c && c <= '9') {
|
||||
continue;
|
||||
}
|
||||
if ('a' <= c && c <= 'f') {
|
||||
continue;
|
||||
}
|
||||
if ('A' <= c && c <= 'F') {
|
||||
continue;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
6
third_party/nix/src/libutil/pool.hh
vendored
6
third_party/nix/src/libutil/pool.hh
vendored
|
|
@ -125,8 +125,9 @@ class Pool {
|
|||
|
||||
/* If we're over the maximum number of instance, we need
|
||||
to wait until a slot becomes available. */
|
||||
while (state_->idle.empty() && state_->inUse >= state_->max)
|
||||
while (state_->idle.empty() && state_->inUse >= state_->max) {
|
||||
state_.wait(wakeup);
|
||||
}
|
||||
|
||||
while (!state_->idle.empty()) {
|
||||
auto p = state_->idle.back();
|
||||
|
|
@ -163,10 +164,11 @@ class Pool {
|
|||
void flushBad() {
|
||||
auto state_(state.lock());
|
||||
std::vector<ref<R>> left;
|
||||
for (auto& p : state_->idle)
|
||||
for (auto& p : state_->idle) {
|
||||
if (validator(p)) {
|
||||
left.push_back(p);
|
||||
}
|
||||
}
|
||||
std::swap(state_->idle, left);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
3
third_party/nix/src/libutil/serialise.hh
vendored
3
third_party/nix/src/libutil/serialise.hh
vendored
|
|
@ -248,9 +248,10 @@ T readNum(Source& source) {
|
|||
((unsigned long long)buf[4] << 32) | ((unsigned long long)buf[5] << 40) |
|
||||
((unsigned long long)buf[6] << 48) | ((unsigned long long)buf[7] << 56);
|
||||
|
||||
if (n > std::numeric_limits<T>::max())
|
||||
if (n > std::numeric_limits<T>::max()) {
|
||||
throw SerialisationError("serialised integer %d is too large for type '%s'",
|
||||
n, typeid(T).name());
|
||||
}
|
||||
|
||||
return (T)n;
|
||||
}
|
||||
|
|
|
|||
6
third_party/nix/src/libutil/thread-pool.hh
vendored
6
third_party/nix/src/libutil/thread-pool.hh
vendored
|
|
@ -90,11 +90,12 @@ void processGraph(ThreadPool& pool, const std::set<T>& nodes,
|
|||
|
||||
{
|
||||
auto graph(graph_.lock());
|
||||
for (auto& ref : refs)
|
||||
for (auto& ref : refs) {
|
||||
if (graph->left.count(ref)) {
|
||||
graph->refs[node].insert(ref);
|
||||
graph->rrefs[ref].insert(node);
|
||||
}
|
||||
}
|
||||
if (graph->refs[node].empty()) {
|
||||
goto doWork;
|
||||
}
|
||||
|
|
@ -131,8 +132,9 @@ void processGraph(ThreadPool& pool, const std::set<T>& nodes,
|
|||
|
||||
pool.process();
|
||||
|
||||
if (!graph_.lock()->left.empty())
|
||||
if (!graph_.lock()->left.empty()) {
|
||||
throw Error("graph processing incomplete (cyclic reference?)");
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace nix
|
||||
|
|
|
|||
8
third_party/nix/src/libutil/util.cc
vendored
8
third_party/nix/src/libutil/util.cc
vendored
|
|
@ -434,13 +434,17 @@ static void _deletePath(int parentfd, const Path& path,
|
|||
|
||||
static void _deletePath(const Path& path, unsigned long long& bytesFreed) {
|
||||
Path dir = dirOf(path);
|
||||
if (dir == "") dir = "/";
|
||||
if (dir == "") {
|
||||
dir = "/";
|
||||
}
|
||||
|
||||
AutoCloseFD dirfd(open(dir.c_str(), O_RDONLY));
|
||||
if (!dirfd) {
|
||||
// This really shouldn't fail silently, but it's left this way
|
||||
// for backwards compatibility.
|
||||
if (errno == ENOENT) return;
|
||||
if (errno == ENOENT) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw SysError(format("opening directory '%1%'") % path);
|
||||
}
|
||||
|
|
|
|||
4
third_party/nix/src/libutil/util.hh
vendored
4
third_party/nix/src/libutil/util.hh
vendored
|
|
@ -301,7 +301,9 @@ void setInterruptThrown();
|
|||
void _interrupted();
|
||||
|
||||
void inline checkInterrupt() {
|
||||
if (_isInterrupted || (interruptCheck && interruptCheck())) _interrupted();
|
||||
if (_isInterrupted || (interruptCheck && interruptCheck())) {
|
||||
_interrupted();
|
||||
}
|
||||
}
|
||||
|
||||
MakeError(Interrupted, BaseError);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue