diff options
author | Pádraig Brady <P@draigBrady.com> | 2009-09-23 10:10:51 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2009-09-23 14:33:40 +0100 |
commit | a037e838e15c9a698f1634398e0fe2726398d575 (patch) | |
tree | 7361ac5f2c3dbd8fc4763e6fa960e6646670dc79 /src/wc.c | |
parent | ade8dd2096e1898edefadf2314d4e1ec654adda5 (diff) | |
download | coreutils-a037e838e15c9a698f1634398e0fe2726398d575.tar.xz |
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)
Diffstat (limited to 'src/wc.c')
-rw-r--r-- | src/wc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -205,10 +205,10 @@ wc (int fd, char const *file_x, struct fstatus *fstatus) else #endif { - count_bytes = print_bytes | print_chars; + count_bytes = print_bytes || print_chars; count_chars = false; } - count_complicated = print_words | print_linelength; + count_complicated = print_words || print_linelength; /* When counting only bytes, save some line- and word-counting overhead. If FD is a `regular' Unix file, using lseek is enough @@ -220,7 +220,7 @@ wc (int fd, char const *file_x, struct fstatus *fstatus) `(dd ibs=99k skip=1 count=0; ./wc -c) < /etc/group' should make wc report `0' bytes. */ - if (count_bytes & !count_chars & !print_lines & !count_complicated) + if (count_bytes && !count_chars && !print_lines && !count_complicated) { off_t current_pos, end_pos; @@ -637,8 +637,8 @@ main (int argc, char **argv) usage (EXIT_FAILURE); } - if (! (print_lines | print_words | print_chars | print_bytes - | print_linelength)) + if (! (print_lines || print_words || print_chars || print_bytes + || print_linelength)) print_lines = print_words = print_bytes = true; bool read_tokens = false; |