[PATCH 4/7] vmx: Convert virVMXConfigScanResultsCollector() to use STRCASESKIP()

Michal Privoznik mprivozn at redhat.com
Wed Nov 16 09:11:42 UTC 2022


Now that we have STRCASESKIP() there's no need to open code it.
Convert virVMXConfigScanResultsCollector() so that it uses this
new macro.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 src/vmx/vmx.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index bf0dba17d8..d3e452e3ef 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1321,12 +1321,13 @@ virVMXConfigScanResultsCollector(const char* name,
                                  void *opaque)
 {
     struct virVMXConfigScanResults *results = opaque;
+    const char *suffix = NULL;
 
-    if (STRCASEPREFIX(name, "ethernet")) {
+    if ((suffix = STRCASESKIP(name, "ethernet"))) {
         unsigned int idx;
         char *p;
 
-        if (virStrToLong_uip(name + 8, &p, 10, &idx) < 0 ||
+        if (virStrToLong_uip(suffix, &p, 10, &idx) < 0 ||
             *p != '.') {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("failed to parse the index of the VMX key '%s'"),
-- 
2.37.4



More information about the libvir-list mailing list