summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-05-12 15:46:43 +0100
committerPádraig Brady <P@draigBrady.com>2014-05-13 23:23:30 +0100
commitffd1a1d8dee921e20db515e7d4b3c3e47006c8b4 (patch)
treec359163ce23eea2ffd65278ed5297596d08e5f72
parentcbfb34c7d32e888b39e03a51a374ed664e9fa31b (diff)
downloadcoreutils-ffd1a1d8dee921e20db515e7d4b3c3e47006c8b4.tar.xz
maint: avoid clang -Wtautological-constant-out-of-range-compare warning
* src/df.c (decode_output_arg): Use only enum constants to avoid clang "warning: comparison of constant -1 with expression of type 'display_field_t' is always false"
-rw-r--r--src/df.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/df.c b/src/df.c
index a7fc57ff7..01ecca6c5 100644
--- a/src/df.c
+++ b/src/df.c
@@ -144,7 +144,8 @@ typedef enum
IAVAIL_FIELD, /* inodes available */
IPCENT_FIELD, /* inodes used in percent */
TARGET_FIELD, /* mount point */
- FILE_FIELD /* specified file name */
+ FILE_FIELD, /* specified file name */
+ INVALID_FIELD /* validation marker */
} display_field_t;
/* Flag if a field contains a block, an inode or another value. */
@@ -372,7 +373,7 @@ decode_output_arg (char const *arg)
*comma++ = 0;
/* process S. */
- display_field_t field = -1;
+ display_field_t field = INVALID_FIELD;
for (unsigned int i = 0; i < ARRAY_CARDINALITY (field_data); i++)
{
if (STREQ (field_data[i].arg, s))
@@ -381,7 +382,7 @@ decode_output_arg (char const *arg)
break;
}
}
- if (field == -1)
+ if (field == INVALID_FIELD)
{
error (0, 0, _("option --output: field %s unknown"), quote (s));
usage (EXIT_FAILURE);