]> xenbits.xensource.com Git - libvirt.git/commitdiff
vmx: Convert virVMXConfigScanResultsCollector() to use STRCASESKIP()
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 10 Nov 2022 13:24:43 +0000 (14:24 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 16 Nov 2022 11:15:08 +0000 (12:15 +0100)
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@redhat.com>
Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
src/vmx/vmx.c

index bf0dba17d8312847800633ffbf04693035484f0e..d3e452e3ef83d65a9a274eb74386e14d223a31f8 100644 (file)
@@ -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'"),