[ovs-dev] [warnings 1/4] lib: Tautological comparisions in ovsdb libaries.
Ethan Jackson
ethan at nicira.com
Tue Sep 13 20:45:50 UTC 2011
This patch fixes compiler warnings like the following:
./lib/ovsdb-types.h:171:5: error: comparison of unsigned expression
>= 0 is always true [-Werror=type-limits]
---
lib/ovsdb-parser.c | 3 +--
lib/ovsdb-types.h | 2 +-
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/ovsdb-parser.c b/lib/ovsdb-parser.c
index e1832a9..555f852 100644
--- a/lib/ovsdb-parser.c
+++ b/lib/ovsdb-parser.c
@@ -80,8 +80,7 @@ ovsdb_parser_member(struct ovsdb_parser *parser, const char *name,
return NULL;
}
- if ((value->type >= 0 && value->type < JSON_N_TYPES
- && types & (1u << value->type))
+ if ((value->type < JSON_N_TYPES && types & (1u << value->type))
|| (types & OP_ID && value->type == JSON_STRING
&& ovsdb_parser_is_id(value->u.string)))
{
diff --git a/lib/ovsdb-types.h b/lib/ovsdb-types.h
index e852391..f93a46d 100644
--- a/lib/ovsdb-types.h
+++ b/lib/ovsdb-types.h
@@ -168,7 +168,7 @@ struct json *ovsdb_type_to_json(const struct ovsdb_type *);
static inline bool
ovsdb_atomic_type_is_valid(enum ovsdb_atomic_type atomic_type)
{
- return atomic_type >= 0 && atomic_type < OVSDB_N_TYPES;
+ return atomic_type < OVSDB_N_TYPES;
}
static inline bool
--
1.7.6.1
More information about the dev
mailing list