From a037e838e15c9a698f1634398e0fe2726398d575 Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Wed, 23 Sep 2009 10:10:51 +0100 Subject: maint: Use logical rather than bitwise operators on bools This is because bitwise operators are: - confusing and inconsistent in a boolean context - non short circuiting - brittle in C89 where bool can be an int (so > 1) --- src/ls.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ls.c') diff --git a/src/ls.c b/src/ls.c index 28fc3e5a8..1bb6873ed 100644 --- a/src/ls.c +++ b/src/ls.c @@ -324,7 +324,7 @@ static bool color_symlink_as_referent; /* mode of appropriate file for colorization */ #define FILE_OR_LINK_MODE(File) \ - ((color_symlink_as_referent & (File)->linkok) \ + ((color_symlink_as_referent && (File)->linkok) \ ? (File)->linkmode : (File)->stat.st_mode) @@ -1176,7 +1176,7 @@ stophandler (int sig) static void process_signals (void) { - while (interrupt_signal | stop_signal_count) + while (interrupt_signal || stop_signal_count) { int sig; int stops; @@ -2477,7 +2477,7 @@ print_dir (char const *name, char const *realname, bool command_line_arg) DEV_INO_PUSH (dir_stat.st_dev, dir_stat.st_ino); } - if (recursive | print_dir_name) + if (recursive || print_dir_name) { if (!first) DIRED_PUTCHAR ('\n'); @@ -2885,7 +2885,7 @@ gobble_file (char const *name, enum filetype type, ino_t inode, f->filetype = symbolic_link; else if (S_ISDIR (f->stat.st_mode)) { - if (command_line_arg & !immediate_dirs) + if (command_line_arg && !immediate_dirs) f->filetype = arg_directory; else f->filetype = directory; @@ -3652,7 +3652,7 @@ print_long_format (const struct fileinfo *f) DIRED_INDENT (); - if (print_owner | print_group | print_author | print_scontext) + if (print_owner || print_group || print_author || print_scontext) { DIRED_FPUTS (buf, stdout, p - buf); -- cgit v1.2.3-54-g00ecf