[libvirt PATCH 2/3] Remove all use of virHexToBin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Replace it by g_ascii_xdigit_value.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/util/virbitmap.c  | 3 +--
 src/util/virmacaddr.c | 5 ++---
 src/vmx/vmx.c         | 4 ++--
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 0679915f70..baf77fe556 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -27,7 +27,6 @@
 #include "viralloc.h"
 #include "virbuffer.h"
 #include "virstring.h"
-#include "virutil.h"
 #include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
@@ -1168,7 +1167,7 @@ virBitmapNewString(const char *string)
         return NULL;
 
     for (i = 0; i < len; i++) {
-        unsigned long nibble = virHexToBin(string[len - i - 1]);
+        unsigned long nibble = g_ascii_xdigit_value(string[len - i - 1]);
         nibble <<= VIR_BITMAP_BIT_OFFSET(i * 4);
         bitmap->map[VIR_BITMAP_UNIT_OFFSET(i * 4)] |= nibble;
     }
diff --git a/src/util/virmacaddr.c b/src/util/virmacaddr.c
index 182bd582fb..35918bca41 100644
--- a/src/util/virmacaddr.c
+++ b/src/util/virmacaddr.c
@@ -23,7 +23,6 @@
 
 #include "virmacaddr.h"
 #include "virrandom.h"
-#include "virutil.h"
 #include "viralloc.h"
 
 static const unsigned char virMacAddrBroadcastAddrRaw[VIR_MAC_BUFLEN] =
@@ -213,8 +212,8 @@ virMacAddrParseHex(const char *str, virMacAddrPtr addr)
         return -1;
 
     for (i = 0; i < VIR_MAC_BUFLEN; i++)
-        addr->addr[i] = (virHexToBin(str[2 * i]) << 4 |
-                         virHexToBin(str[2 * i + 1]));
+        addr->addr[i] = (g_ascii_xdigit_value(str[2 * i]) << 4 |
+                         g_ascii_xdigit_value(str[2 * i + 1]));
     return 0;
 }
 
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 4362da6cee..b0f7b6a977 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -28,7 +28,6 @@
 #include "virconf.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "viruuid.h"
 #include "vmx.h"
 #include "viruri.h"
 #include "virstring.h"
@@ -673,7 +672,8 @@ virVMXUnescapeHex(char *string, char escape)
             if (!g_ascii_isxdigit(tmp1[1]) || !g_ascii_isxdigit(tmp1[2]))
                 return -1;
 
-            *tmp2++ = virHexToBin(tmp1[1]) * 16 + virHexToBin(tmp1[2]);
+            *tmp2++ = g_ascii_xdigit_value(tmp1[1]) * 16 +
+                g_ascii_xdigit_value(tmp1[2]);
             tmp1 += 3;
         } else {
             *tmp2++ = *tmp1++;
-- 
2.24.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux