mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
lint: Use early exit/continue
This commit is contained in:
parent
4fe2a2921f
commit
225caa2fe8
1 changed files with 34 additions and 33 deletions
|
@ -270,28 +270,30 @@ static void print_profile(const std::vector<profile_item_t *> &items, FILE *out)
|
|||
int my_time;
|
||||
|
||||
me = items.at(pos);
|
||||
if (!me->skipped) {
|
||||
my_time = me->parse + me->exec;
|
||||
if (me->skipped) {
|
||||
continue;
|
||||
}
|
||||
|
||||
my_time = me->parse + me->exec;
|
||||
for (i = pos + 1; i < items.size(); i++) {
|
||||
prev = items.at(i);
|
||||
if (prev->skipped) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (prev->level <= me->level) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (prev->level > me->level + 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
my_time -= prev->parse;
|
||||
my_time -= prev->exec;
|
||||
my_time -= prev->parse + prev->exec;
|
||||
}
|
||||
|
||||
if (me->cmd.size() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (me->cmd.size() > 0) {
|
||||
if (fwprintf(out, L"%d\t%d\t", my_time, me->parse + me->exec) < 0) {
|
||||
wperror(L"fwprintf");
|
||||
return;
|
||||
|
@ -303,14 +305,13 @@ static void print_profile(const std::vector<profile_item_t *> &items, FILE *out)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (fwprintf(out, L"> %ls\n", me->cmd.c_str()) < 0) {
|
||||
wperror(L"fwprintf");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void parser_t::emit_profiling(const char *path) const {
|
||||
// Save profiling information. OK to not use CLO_EXEC here because this is called while fish is
|
||||
|
|
Loading…
Reference in a new issue