The same way how we have IS_EOL in two files where we actually need it defince IS_BLANK so we can drop usage of c_isblank. Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx> --- src/util/virconf.c | 7 ++++--- src/util/virkeyfile.c | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/util/virconf.c b/src/util/virconf.c index cc88000387..6d03bbd222 100644 --- a/src/util/virconf.c +++ b/src/util/virconf.c @@ -56,13 +56,14 @@ struct _virConfParserCtxt { #define CUR (*ctxt->cur) #define NEXT if (ctxt->cur < ctxt->end) ctxt->cur++; #define IS_EOL(c) (((c) == '\n') || ((c) == '\r')) +#define IS_BLANK(c) (((c) == ' ' || ((c) == '\t')) #define SKIP_BLANKS_AND_EOL \ - do { while ((ctxt->cur < ctxt->end) && (c_isblank(CUR) || IS_EOL(CUR))) { \ + do { while ((ctxt->cur < ctxt->end) && (IS_BLANK(CUR) || IS_EOL(CUR))) { \ if (CUR == '\n') ctxt->line++; \ ctxt->cur++; } } while (0) #define SKIP_BLANKS \ - do { while ((ctxt->cur < ctxt->end) && (c_isblank(CUR))) \ + do { while ((ctxt->cur < ctxt->end) && (IS_BLANK(CUR))) \ ctxt->cur++; } while (0) VIR_ENUM_IMPL(virConf, @@ -428,7 +429,7 @@ virConfParseString(virConfParserCtxtPtr ctxt) while ((ctxt->cur < ctxt->end) && (!IS_EOL(CUR))) NEXT; /* Reverse to exclude the trailing blanks from the value */ - while ((ctxt->cur > base) && (c_isblank(CUR))) + while ((ctxt->cur > base) && (IS_BLANK(CUR))) ctxt->cur--; if (VIR_STRNDUP(ret, base, ctxt->cur - base) < 0) return NULL; diff --git a/src/util/virkeyfile.c b/src/util/virkeyfile.c index c7e756d26a..6cd3a5168e 100644 --- a/src/util/virkeyfile.c +++ b/src/util/virkeyfile.c @@ -77,6 +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 CUR (*ctxt->cur) #define NEXT if (!IS_EOF) ctxt->cur++; @@ -205,7 +206,7 @@ static int virKeyFileParseComment(virKeyFileParserCtxtPtr ctxt) static int virKeyFileParseBlank(virKeyFileParserCtxtPtr ctxt) { - while ((ctxt->cur < ctxt->end) && c_isblank(CUR)) + while ((ctxt->cur < ctxt->end) && IS_BLANK(CUR)) ctxt->cur++; if (!((ctxt->cur == ctxt->end) || IS_EOL(CUR))) { @@ -226,7 +227,7 @@ static int virKeyFileParseStatement(virKeyFileParserCtxtPtr ctxt) ret = virKeyFileParseValue(ctxt); } else if (CUR == '#' || CUR == ';') { ret = virKeyFileParseComment(ctxt); - } else if (c_isblank(CUR) || IS_EOL(CUR)) { + } else if (IS_BLANK(CUR) || IS_EOL(CUR)) { ret = virKeyFileParseBlank(ctxt); } else { virKeyFileError(ctxt, VIR_ERR_CONF_SYNTAX, "unexpected statement"); -- 2.23.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list