]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
virkeyfile: fix compilation error with clang
authorPavel Hrdina <phrdina@redhat.com>
Tue, 10 Dec 2019 14:06:49 +0000 (15:06 +0100)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 10 Dec 2019 15:03:39 +0000 (16:03 +0100)
Clang complains about condition being always true:

src/util/virkeyfile.c:113:23: error: result of comparison of constant 128 with expression of type 'const char' is always true [-Werror,-Wtautological-constant-out-of-range-compare]
    while (!IS_EOF && IS_ASCII(CUR) && CUR != ']')
                      ^~~~~~~~~~~~~
src/util/virkeyfile.c:80:26: note: expanded from macro 'IS_ASCII'
                     ~~~ ^ ~~~

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/util/virkeyfile.c

index 816bfae96de257c602e87f1ed62ccc562a9bbb5b..a98d60cdb188fa151599f1641d0276327bf7698e 100644 (file)
@@ -77,7 +77,7 @@ struct _virKeyFileParserCtxt {
 #define IS_EOF (ctxt->cur >= ctxt->end)
 #define IS_EOL(c) (((c) == '\n') || ((c) == '\r'))
 #define IS_BLANK(c) (((c) == ' ') || ((c) == '\t'))
-#define IS_ASCII(c) ((c) < 128)
+#define IS_ASCII(c) (((unsigned char) (c)) < 128)
 #define CUR (*ctxt->cur)
 #define NEXT if (!IS_EOF) ctxt->cur++;