Thread (5 messages) 5 messages, 3 authors, 2016-08-10

Re: [PATCHv2] fsck: fix strange logic

From: Theodore Ts'o <tytso@mit.edu>
Date: 2016-08-10 22:55:02

On Tue, Aug 09, 2016 at 02:27:09PM -0600, Andreas Dilger wrote:
llvm warns about the confusingly written comparison:

                              !strncmp(argv[i+1], "-", 1) == 0) {
    misc/fsck.c:1178 col 9: warning: logical not is only applied to
      the left hand side of comparison [-Wlogical-not-parentheses]
    misc/fsck.c:1178 col 9: note: add parentheses after the '!' to
      evaluate the comparison first
    misc/fsck.c:1178 col 9: note: add parentheses around left hand
      side expression to silence this warning

It makes sense to simplify this to a character comparison rather
than using strncmp() to check only one character.

Signed-off-by: Andreas Dilger <redacted>
Thanks, applied.

						- Ted
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help