Skip to content

Commit

Permalink
Use stdbool.h for booleans
Browse files Browse the repository at this point in the history
We don't need to reinvent these, especially in a confusing form
(bool type like stdbool.h, but TRUE and FALSE constants like GLib).
stdbool.h was available in the gcc 4.6 that is the default compiler in
Ubuntu 12.04, more than a decade ago, so it seems sufficiently
ubiquitous.

Signed-off-by: Simon McVittie <smcv@collabora.com>
  • Loading branch information
smcv committed Oct 8, 2024
1 parent 5dab8b8 commit 47ff41e
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 101 deletions.
20 changes: 10 additions & 10 deletions bind-mount.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ match_token (const char *token, const char *token_end, const char *str)
if (token == token_end)
return *str == 0;

return FALSE;
return false;
}

static unsigned long
Expand Down Expand Up @@ -281,12 +281,12 @@ parse_mountinfo (int proc_fd,
die ("Can't parse mountinfo line");
rest = line + consumed;

rest = skip_token (rest, TRUE); /* mountroot */
rest = skip_token (rest, true); /* mountroot */
mountpoint = rest;
rest = skip_token (rest, FALSE); /* mountpoint */
rest = skip_token (rest, false); /* mountpoint */
mountpoint_end = rest++;
options = rest;
rest = skip_token (rest, FALSE); /* vfs options */
rest = skip_token (rest, false); /* vfs options */
options_end = rest;

*mountpoint_end = 0;
Expand Down Expand Up @@ -324,7 +324,7 @@ parse_mountinfo (int proc_fd,
MountInfoLine *parent = by_id[this->parent_id];
MountInfoLine **to_sibling;
MountInfoLine *sibling;
bool covered = FALSE;
bool covered = false;

if (!has_path_prefix (this->mountpoint, root_mount))
continue;
Expand All @@ -333,7 +333,7 @@ parse_mountinfo (int proc_fd,
continue;

if (strcmp (parent->mountpoint, this->mountpoint) == 0)
parent->covered = TRUE;
parent->covered = true;

to_sibling = &parent->first_child;
sibling = parent->first_child;
Expand All @@ -344,7 +344,7 @@ parse_mountinfo (int proc_fd,
* covered by the sibling, and we drop it. */
if (has_path_prefix (this->mountpoint, sibling->mountpoint))
{
covered = TRUE;
covered = true;
break;
}

Expand Down Expand Up @@ -499,7 +499,7 @@ bind_mount_result_to_string (bind_mount_result res,
bool *want_errno_p)
{
char *string = NULL;
bool want_errno = TRUE;
bool want_errno = true;

switch (res)
{
Expand All @@ -521,7 +521,7 @@ bind_mount_result_to_string (bind_mount_result res,

case BIND_MOUNT_ERROR_FIND_DEST_MOUNT:
string = xasprintf ("Unable to find \"%s\" in mount table", failing_path);
want_errno = FALSE;
want_errno = false;
break;

case BIND_MOUNT_ERROR_REMOUNT_DEST:
Expand Down Expand Up @@ -557,7 +557,7 @@ die_with_bind_result (bind_mount_result res,
...)
{
va_list args;
bool want_errno = TRUE;
bool want_errno = true;
char *message;

if (bwrap_level_prefix)
Expand Down
Loading

0 comments on commit 47ff41e

Please sign in to comment.