[libvirt] [PATCH v2 02/14] virkeyfile: define IS_ASCII instead c_isascii from gnulib

Pavel Hrdina posted 14 patches 6 years ago
[libvirt] [PATCH v2 02/14] virkeyfile: define IS_ASCII instead c_isascii from gnulib
Posted by Pavel Hrdina 6 years ago
GLib doesn't provide alternative to c_isascii and this is the only usage
of that macro so define a replacement ourselves.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/util/virkeyfile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util/virkeyfile.c b/src/util/virkeyfile.c
index 6cd3a5168e..054a187ba2 100644
--- a/src/util/virkeyfile.c
+++ b/src/util/virkeyfile.c
@@ -21,7 +21,6 @@
 #include <config.h>
 
 
-#include "c-ctype.h"
 #include "virlog.h"
 #include "viralloc.h"
 #include "virfile.h"
@@ -78,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 IS_ASCII(c) ((c) < 128)
 #define CUR (*ctxt->cur)
 #define NEXT if (!IS_EOF) ctxt->cur++;
 
@@ -110,7 +110,7 @@ static int virKeyFileParseGroup(virKeyFileParserCtxtPtr ctxt)
     VIR_FREE(ctxt->groupname);
 
     name = ctxt->cur;
-    while (!IS_EOF && c_isascii(CUR) && CUR != ']')
+    while (!IS_EOF && IS_ASCII(CUR) && CUR != ']')
         ctxt->cur++;
     if (CUR != ']') {
         virKeyFileError(ctxt, VIR_ERR_CONF_SYNTAX, "cannot find end of group name, expected ']'");
-- 
2.23.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH v2 02/14] virkeyfile: define IS_ASCII instead c_isascii from gnulib
Posted by Cole Robinson 6 years ago
On 11/20/19 9:48 AM, Pavel Hrdina wrote:
> GLib doesn't provide alternative to c_isascii and this is the only usage
> of that macro so define a replacement ourselves.
> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  src/util/virkeyfile.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/util/virkeyfile.c b/src/util/virkeyfile.c
> index 6cd3a5168e..054a187ba2 100644
> --- a/src/util/virkeyfile.c
> +++ b/src/util/virkeyfile.c
> @@ -21,7 +21,6 @@
>  #include <config.h>
>  
>  
> -#include "c-ctype.h"
>  #include "virlog.h"
>  #include "viralloc.h"
>  #include "virfile.h"

This removal needs to go in the next patch otherwise compilation fails here

- Cole

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list