Convert some old-school int booleans to bool

This commit is contained in:
Mahmoud Al-Qudsi 2018-12-31 00:43:26 -06:00
parent 0337588979
commit 803619b19b
5 changed files with 17 additions and 17 deletions

View file

@ -53,12 +53,12 @@ int builtin_fg(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
// try to locate the job argv[1], since we want to know if this is an ambigous job
// specification or if this is an malformed job id.
int pid;
int found_job = 0;
bool found_job = false;
pid = fish_wcstoi(argv[optind]);
if (!(errno || pid < 0)) {
j = job_t::from_pid(pid);
if (j) found_job = 1;
if (j) found_job = true;
}
if (found_job) {

View file

@ -115,7 +115,7 @@ static void builtin_jobs_print(const job_t *j, int mode, int header, io_streams_
int builtin_jobs(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
wchar_t *cmd = argv[0];
int argc = builtin_count_args(argv);
int found = 0;
bool found = false;
int mode = JOBS_DEFAULT;
int print_last = 0;
@ -210,7 +210,7 @@ int builtin_jobs(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
if (j && !j->is_completed() && j->is_constructed()) {
builtin_jobs_print(j, mode, false, streams);
found = 1;
found = true;
} else {
streams.err.append_format(_(L"%ls: No suitable job: %ls\n"), cmd, argv[i]);
return STATUS_CMD_ERROR;
@ -223,7 +223,7 @@ int builtin_jobs(parser_t &parser, io_streams_t &streams, wchar_t **argv) {
// Ignore unconstructed jobs, i.e. ourself.
if (j->is_constructed() && !j->is_completed()) {
builtin_jobs_print(j, mode, !found && !streams.out_is_redirected, streams);
found = 1;
found = true;
}
}
}

View file

@ -1231,7 +1231,7 @@ static void highlight_universal_internal(const wcstring &buffstr,
wchar_t prev_q = 0;
const wchar_t *const buff = buffstr.c_str();
const wchar_t *str = buff;
int match_found = 0;
bool match_found = false;
while (*str) {
switch (*str) {
@ -1257,7 +1257,7 @@ static void highlight_universal_internal(const wcstring &buffstr,
highlight_make_background(highlight_spec_match);
color.at(pos2) |=
highlight_make_background(highlight_spec_match);
match_found = 1;
match_found = true;
}
prev_q = *str == L'\"' ? L'\'' : L'\"';
} else {
@ -1286,7 +1286,7 @@ static void highlight_universal_internal(const wcstring &buffstr,
wchar_t dec_char = *(wcschr(L"()[]{}", c) + step);
wchar_t inc_char = c;
int level = 0;
int match_found = 0;
bool match_found = false;
for (long i = pos; i >= 0 && (size_t)i < buffstr.size(); i += step) {
const wchar_t test_char = buffstr.at(i);
if (test_char == inc_char) level++;
@ -1295,7 +1295,7 @@ static void highlight_universal_internal(const wcstring &buffstr,
long pos2 = i;
color.at(pos) |= highlight_spec_match << 16;
color.at(pos2) |= highlight_spec_match << 16;
match_found = 1;
match_found = true;
break;
}
}

View file

@ -604,10 +604,10 @@ void proc_fire_event(const wchar_t *msg, int type, pid_t pid, int status) {
event.arguments.resize(0);
}
static int process_clean_after_marking(bool allow_interactive) {
static bool process_clean_after_marking(bool allow_interactive) {
ASSERT_IS_MAIN_THREAD();
job_t *jnext;
int found = 0;
bool found = false;
// this function may fire an event handler, we do not want to call ourselves recursively (to
// avoid infinite recursion).
@ -697,7 +697,7 @@ static int process_clean_after_marking(bool allow_interactive) {
if (clr_eol) tputs(clr_eol, 1, &writeb);
fwprintf(stdout, L"\n");
}
found = 1;
found = false;
p->status = 0; // clear status so it is not reported more than once
}
@ -707,7 +707,7 @@ static int process_clean_after_marking(bool allow_interactive) {
if (!j->is_foreground() && !j->get_flag(job_flag_t::NOTIFIED) &&
!j->get_flag(job_flag_t::SKIP_NOTIFICATION)) {
format_job_info(j, JOB_ENDED);
found = 1;
found = true;
}
// TODO: The generic process-exit event is useless and unused.
// Remove this in future.
@ -725,7 +725,7 @@ static int process_clean_after_marking(bool allow_interactive) {
// Notify the user about newly stopped jobs.
if (!j->get_flag(job_flag_t::SKIP_NOTIFICATION)) {
format_job_info(j, JOB_STOPPED);
found = 1;
found = true;
}
j->set_flag(job_flag_t::NOTIFIED, true);
}
@ -738,9 +738,9 @@ static int process_clean_after_marking(bool allow_interactive) {
return found;
}
int job_reap(bool allow_interactive) {
bool job_reap(bool allow_interactive) {
ASSERT_IS_MAIN_THREAD();
int found = 0;
bool found = false;
process_mark_finished_children(false);

View file

@ -354,7 +354,7 @@ int proc_get_last_status();
/// Notify the user about stopped or terminated jobs. Delete terminated jobs from the job list.
///
/// \param interactive whether interactive jobs should be reaped as well
int job_reap(bool interactive);
bool job_reap(bool interactive);
/// Signal handler for SIGCHLD. Mark any processes with relevant information.
void job_handle_signal(int signal, siginfo_t *info, void *con);