[libvirt] [PATCH 08/13] use g_ascii_isspace instead of c_isspace from gnulib

Pavel Hrdina phrdina at redhat.com
Wed Nov 20 14:07:50 UTC 2019


Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 src/bhyve/bhyve_parse_command.c        | 3 +--
 src/conf/nwfilter_conf.c               | 3 +--
 src/interface/interface_backend_udev.c | 3 +--
 src/rpc/virnetsocket.c                 | 3 +--
 src/util/virhostcpu.c                  | 7 +++----
 src/util/virnetdevvportprofile.c       | 3 +--
 src/util/virpidfile.c                  | 3 +--
 src/util/virstoragefile.c              | 3 +--
 src/util/virstring.c                   | 6 +++---
 src/util/viruuid.c                     | 4 ++--
 10 files changed, 15 insertions(+), 23 deletions(-)

diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_command.c
index 050a558cee..5eec05c7d4 100644
--- a/src/bhyve/bhyve_parse_command.c
+++ b/src/bhyve/bhyve_parse_command.c
@@ -31,7 +31,6 @@
 #include "virlog.h"
 #include "virstring.h"
 #include "virutil.h"
-#include "c-ctype.h"
 
 #define VIR_FROM_THIS VIR_FROM_BHYVE
 
@@ -212,7 +211,7 @@ bhyveCommandLineToArgv(const char *nativeConfig,
             arglist[args_count++] = arg;
             arglist[args_count] = NULL;
 
-            while (next && c_isspace(*next))
+            while (next && g_ascii_isspace(*next))
                 next++;
 
             curr = next;
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index 6c7b85d4c8..5bcf52a84c 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -42,7 +42,6 @@
 #include "nwfilter_params.h"
 #include "nwfilter_conf.h"
 #include "domain_conf.h"
-#include "c-ctype.h"
 #include "virfile.h"
 #include "virstring.h"
 
@@ -775,7 +774,7 @@ parseStringItems(const struct int_map *int_map,
     i = 0;
     while (input[i]) {
         found = false;
-        while (c_isspace(input[i]) || input[i] == sep)
+        while (g_ascii_isspace(input[i]) || input[i] == sep)
             i++;
         if (!input[i])
             break;
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index 29d91d3539..7df5cf2cc3 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -25,7 +25,6 @@
 
 #include "virerror.h"
 #include "virfile.h"
-#include "c-ctype.h"
 #include "datatypes.h"
 #include "domain_conf.h"
 #include "interface_driver.h"
@@ -932,7 +931,7 @@ udevGetIfaceDefVlan(struct udev *udev G_GNUC_UNUSED,
     vid_pos += strlen(vid_prefix);
 
     if ((vid_len = strspn(vid_pos, "0123456789")) == 0 ||
-        !c_isspace(vid_pos[vid_len])) {
+        !g_ascii_isspace(vid_pos[vid_len])) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
                        _("failed to find the VID for the VLAN device '%s'"),
                        name);
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 21ef7a8034..b98287e6d7 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -40,7 +40,6 @@
 # include <sys/ucred.h>
 #endif
 
-#include "c-ctype.h"
 #ifdef WITH_SELINUX
 # include <selinux/selinux.h>
 #endif
@@ -1813,7 +1812,7 @@ static ssize_t virNetSocketReadWire(virNetSocketPtr sock, char *buf, size_t len)
         errout != NULL) {
         size_t elen = strlen(errout);
         /* remove trailing whitespace */
-        while (elen && c_isspace(errout[elen - 1]))
+        while (elen && g_ascii_isspace(errout[elen - 1]))
             errout[--elen] = '\0';
     }
 
diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index a3ef067f41..22102f2c75 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -38,7 +38,6 @@
 # include <sys/resource.h>
 #endif
 
-#include "c-ctype.h"
 #include "viralloc.h"
 #define LIBVIRT_VIRHOSTCPUPRIV_H_ALLOW
 #include "virhostcpupriv.h"
@@ -512,7 +511,7 @@ virHostCPUParseFrequencyString(const char *str,
     str += strlen(prefix);
 
     /* Skip all whitespace */
-    while (c_isspace(*str))
+    while (g_ascii_isspace(*str))
         str++;
     if (*str == '\0')
         goto error;
@@ -524,7 +523,7 @@ virHostCPUParseFrequencyString(const char *str,
     str++;
 
     /* Skip all whitespace */
-    while (c_isspace(*str))
+    while (g_ascii_isspace(*str))
         str++;
     if (*str == '\0')
         goto error;
@@ -533,7 +532,7 @@ virHostCPUParseFrequencyString(const char *str,
      * followed by a fractional part (which gets discarded) or some
      * leading whitespace */
     if (virStrToLong_ui(str, &p, 10, &ui) < 0 ||
-        (*p != '.' && *p != '\0' && !c_isspace(*p))) {
+        (*p != '.' && *p != '\0' && !g_ascii_isspace(*p))) {
         goto error;
     }
 
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index 6442c2a2cf..a7e7361a4c 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -49,7 +49,6 @@ VIR_ENUM_IMPL(virNetDevVPortProfileOp,
 #if WITH_VIRTUALPORT
 
 # include <fcntl.h>
-# include <c-ctype.h>
 # include <sys/socket.h>
 # include <sys/ioctl.h>
 
@@ -482,7 +481,7 @@ virNetDevVPortProfileGetLldpadPid(void)
             char *endptr;
 
             if (virStrToLong_ui(buffer, &endptr, 10, &res) == 0
-                && (*endptr == '\0' || c_isspace(*endptr))
+                && (*endptr == '\0' || g_ascii_isspace(*endptr))
                 && res != 0) {
                 pid = res;
             } else {
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index a825a23e49..249515aff2 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -34,7 +34,6 @@
 #include "intprops.h"
 #include "virlog.h"
 #include "virerror.h"
-#include "c-ctype.h"
 #include "virstring.h"
 #include "virprocess.h"
 
@@ -130,7 +129,7 @@ int virPidFileReadPath(const char *path,
     pidstr[bytes] = '\0';
 
     if (virStrToLong_ll(pidstr, &endptr, 10, &pid_value) < 0 ||
-        !(*endptr == '\0' || c_isspace(*endptr)) ||
+        !(*endptr == '\0' || g_ascii_isspace(*endptr)) ||
         (pid_t) pid_value != pid_value) {
         rc = -1;
         goto cleanup;
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 77f885ef1d..5e371694d1 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -30,7 +30,6 @@
 #include "virerror.h"
 #include "virlog.h"
 #include "virfile.h"
-#include "c-ctype.h"
 #include "vircommand.h"
 #include "virhash.h"
 #include "virendian.h"
@@ -1376,7 +1375,7 @@ int virStorageFileGetLVMKey(const char *path,
         char *tmp = *key;
 
         /* Find first non-space character */
-        while (*tmp && c_isspace(*tmp))
+        while (*tmp && g_ascii_isspace(*tmp))
             tmp++;
         /* Kill leading spaces */
         if (tmp != *key)
diff --git a/src/util/virstring.c b/src/util/virstring.c
index a66b406298..311c9058db 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -794,7 +794,7 @@ virSkipSpaces(const char **str)
 {
     const char *cur = *str;
 
-    while (c_isspace(*cur))
+    while (g_ascii_isspace(*cur))
         cur++;
     *str = cur;
 }
@@ -811,7 +811,7 @@ virSkipSpacesAndBackslash(const char **str)
 {
     const char *cur = *str;
 
-    while (c_isspace(*cur) || *cur == '\\')
+    while (g_ascii_isspace(*cur) || *cur == '\\')
         cur++;
     *str = cur;
 }
@@ -840,7 +840,7 @@ virTrimSpaces(char *str, char **endp)
         end = str + strlen(str);
     else
         end = *endp;
-    while (end > str && c_isspace(end[-1]))
+    while (end > str && g_ascii_isspace(end[-1]))
         end--;
     if (endp) {
         if (!*endp)
diff --git a/src/util/viruuid.c b/src/util/viruuid.c
index 7626d72c23..835c873300 100644
--- a/src/util/viruuid.c
+++ b/src/util/viruuid.c
@@ -102,7 +102,7 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid)
      * 32 hexadecimal digits the end.
      */
     cur = uuidstr;
-    while (c_isspace(*cur))
+    while (g_ascii_isspace(*cur))
         cur++;
 
     for (i = 0; i < VIR_UUID_BUFLEN;) {
@@ -128,7 +128,7 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid)
     }
 
     while (*cur) {
-        if (!c_isspace(*cur))
+        if (!g_ascii_isspace(*cur))
             goto error;
         cur++;
     }
-- 
2.23.0




More information about the libvir-list mailing list