[PATCH 08/16] conf: Refactor ABI stability checking and break long lines

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

 



Get rid of the "identical" variable in the ABI stability checks in favor
of return statements and break or refactor very long lines where
possible.
---
 src/conf/domain_conf.c | 469 +++++++++++++++++++++----------------------------
 1 file changed, 200 insertions(+), 269 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b4340f3..8024bff 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -10957,21 +10957,19 @@ static bool
 virDomainTimerDefCheckABIStability(virDomainTimerDefPtr src,
                                    virDomainTimerDefPtr dst)
 {
-    bool identical = false;
-
     if (src->name != dst->name) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target timer %s does not match source %s"),
                        virDomainTimerNameTypeToString(dst->name),
                        virDomainTimerNameTypeToString(src->name));
-        goto cleanup;
+        return false;
     }

     if (src->present != dst->present) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target timer presence %d does not match source %d"),
                        dst->present, src->present);
-        goto cleanup;
+        return false;
     }

     if (src->name == VIR_DOMAIN_TIMER_NAME_TSC) {
@@ -10979,7 +10977,7 @@ virDomainTimerDefCheckABIStability(virDomainTimerDefPtr src,
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Target TSC frequency %lu does not match source %lu"),
                            dst->frequency, src->frequency);
-            goto cleanup;
+            return false;
         }

         if (src->mode != dst->mode) {
@@ -10987,14 +10985,11 @@ virDomainTimerDefCheckABIStability(virDomainTimerDefPtr src,
                            _("Target TSC mode %s does not match source %s"),
                            virDomainTimerModeTypeToString(dst->mode),
                            virDomainTimerModeTypeToString(src->mode));
-            goto cleanup;
+            return false;
         }
     }

-    identical = true;
-
-cleanup:
-    return identical;
+    return true;
 }


@@ -11002,14 +10997,12 @@ static bool
 virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src,
                                      virDomainDeviceInfoPtr dst)
 {
-    bool identical = false;
-
     if (src->type != dst->type) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target device address type %s does not match source %s"),
                        virDomainDeviceAddressTypeToString(dst->type),
                        virDomainDeviceAddressTypeToString(src->type));
-        goto cleanup;
+        return false;
     }

     switch (src->type) {
@@ -11025,7 +11018,7 @@ virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src,
                            dst->addr.pci.slot, dst->addr.pci.function,
                            src->addr.pci.domain, src->addr.pci.bus,
                            src->addr.pci.slot, src->addr.pci.function);
-            goto cleanup;
+            return false;
         }
         break;

@@ -11034,12 +11027,13 @@ virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src,
             src->addr.drive.bus != dst->addr.drive.bus ||
             src->addr.drive.unit != dst->addr.drive.unit) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Target device drive address %d:%d:%d does not match source %d:%d:%d"),
+                           _("Target device drive address %d:%d:%d "
+                             "does not match source %d:%d:%d"),
                            dst->addr.drive.controller, dst->addr.drive.bus,
                            dst->addr.drive.unit,
                            src->addr.drive.controller, src->addr.drive.bus,
                            src->addr.drive.unit);
-            goto cleanup;
+            return false;
         }
         break;

@@ -11048,12 +11042,13 @@ virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src,
             src->addr.vioserial.bus != dst->addr.vioserial.bus ||
             src->addr.vioserial.port != dst->addr.vioserial.port) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Target device virtio serial address %d:%d:%d does not match source %d:%d:%d"),
+                           _("Target device virtio serial address %d:%d:%d "
+                             "does not match source %d:%d:%d"),
                            dst->addr.vioserial.controller, dst->addr.vioserial.bus,
                            dst->addr.vioserial.port,
                            src->addr.vioserial.controller, src->addr.vioserial.bus,
                            src->addr.vioserial.port);
-            goto cleanup;
+            return false;
         }
         break;

@@ -11061,20 +11056,18 @@ virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src,
         if (src->addr.ccid.controller != dst->addr.ccid.controller ||
             src->addr.ccid.slot != dst->addr.ccid.slot) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Target device ccid address %d:%d does not match source %d:%d"),
+                           _("Target device ccid address %d:%d "
+                             "does not match source %d:%d"),
                            dst->addr.ccid.controller,
                            dst->addr.ccid.slot,
                            src->addr.ccid.controller,
                            src->addr.ccid.slot);
-            goto cleanup;
+            return false;
         }
         break;
     }

-    identical = true;
-
-cleanup:
-    return identical;
+    return true;
 }


@@ -11082,14 +11075,12 @@ static bool
 virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src,
                                   virDomainDiskDefPtr dst)
 {
-    bool identical = false;
-
     if (src->device != dst->device) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target disk device %s does not match source %s"),
                        virDomainDiskDeviceTypeToString(dst->device),
                        virDomainDiskDeviceTypeToString(src->device));
-        goto cleanup;
+        return false;
     }

     if (src->bus != dst->bus) {
@@ -11097,36 +11088,33 @@ virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src,
                        _("Target disk bus %s does not match source %s"),
                        virDomainDiskBusTypeToString(dst->bus),
                        virDomainDiskBusTypeToString(src->bus));
-        goto cleanup;
+        return false;
     }

     if (STRNEQ(src->dst, dst->dst)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target disk %s does not match source %s"),
                        dst->dst, src->dst);
-        goto cleanup;
+        return false;
     }

     if (STRNEQ_NULLABLE(src->serial, dst->serial)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target disk serial %s does not match source %s"),
                        NULLSTR(dst->serial), NULLSTR(src->serial));
-        goto cleanup;
+        return false;
     }

     if (src->readonly != dst->readonly || src->shared != dst->shared) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("Target disk access mode does not match source"));
-        goto cleanup;
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11134,28 +11122,26 @@ static bool
 virDomainControllerDefCheckABIStability(virDomainControllerDefPtr src,
                                         virDomainControllerDefPtr dst)
 {
-    bool identical = false;
-
     if (src->type != dst->type) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target controller type %s does not match source %s"),
                        virDomainControllerTypeToString(dst->type),
                        virDomainControllerTypeToString(src->type));
-        goto cleanup;
+        return false;
     }

     if (src->idx != dst->idx) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target controller index %d does not match source %d"),
                        dst->idx, src->idx);
-        goto cleanup;
+        return false;
     }

     if (src->model != dst->model) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target controller model %d does not match source %d"),
                        dst->model, src->model);
-        goto cleanup;
+        return false;
     }

     if (src->type == VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL) {
@@ -11163,24 +11149,21 @@ virDomainControllerDefCheckABIStability(virDomainControllerDefPtr src,
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Target controller ports %d does not match source %d"),
                            dst->opts.vioserial.ports, src->opts.vioserial.ports);
-            goto cleanup;
+            return false;
         }

         if (src->opts.vioserial.vectors != dst->opts.vioserial.vectors) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Target controller vectors %d does not match source %d"),
                            dst->opts.vioserial.vectors, src->opts.vioserial.vectors);
-            goto cleanup;
+            return false;
         }
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11188,28 +11171,23 @@ static bool
 virDomainFsDefCheckABIStability(virDomainFSDefPtr src,
                                 virDomainFSDefPtr dst)
 {
-    bool identical = false;
-
     if (STRNEQ(src->dst, dst->dst)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target filesystem guest target %s does not match source %s"),
                        dst->dst, src->dst);
-        goto cleanup;
+        return false;
     }

     if (src->readonly != dst->readonly) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("Target filesystem access mode does not match source"));
-        goto cleanup;
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11217,8 +11195,6 @@ static bool
 virDomainNetDefCheckABIStability(virDomainNetDefPtr src,
                                  virDomainNetDefPtr dst)
 {
-    bool identical = false;
-
     if (virMacAddrCmp(&src->mac, &dst->mac) != 0) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target network card mac %02x:%02x:%02x:%02x:%02x:%02x"
@@ -11227,23 +11203,20 @@ virDomainNetDefCheckABIStability(virDomainNetDefPtr src,
                        dst->mac.addr[3], dst->mac.addr[4], dst->mac.addr[5],
                        src->mac.addr[0], src->mac.addr[1], src->mac.addr[2],
                        src->mac.addr[3], src->mac.addr[4], src->mac.addr[5]);
-        goto cleanup;
+        return false;
     }

     if (STRNEQ_NULLABLE(src->model, dst->model)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target network card model %s does not match source %s"),
                        NULLSTR(dst->model), NULLSTR(src->model));
-        goto cleanup;
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11251,14 +11224,12 @@ static bool
 virDomainInputDefCheckABIStability(virDomainInputDefPtr src,
                                    virDomainInputDefPtr dst)
 {
-    bool identical = false;
-
     if (src->type != dst->type) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target input device type %s does not match source %s"),
                        virDomainInputTypeToString(dst->type),
                        virDomainInputTypeToString(src->type));
-        goto cleanup;
+        return false;
     }

     if (src->bus != dst->bus) {
@@ -11266,16 +11237,13 @@ virDomainInputDefCheckABIStability(virDomainInputDefPtr src,
                        _("Target input device bus %s does not match source %s"),
                        virDomainInputBusTypeToString(dst->bus),
                        virDomainInputBusTypeToString(src->bus));
-        goto cleanup;
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11283,23 +11251,18 @@ static bool
 virDomainSoundDefCheckABIStability(virDomainSoundDefPtr src,
                                    virDomainSoundDefPtr dst)
 {
-    bool identical = false;
-
     if (src->model != dst->model) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target sound card model %s does not match source %s"),
                        virDomainSoundModelTypeToString(dst->model),
                        virDomainSoundModelTypeToString(src->model));
-        goto cleanup;
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11307,35 +11270,33 @@ static bool
 virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src,
                                    virDomainVideoDefPtr dst)
 {
-    bool identical = false;
-
     if (src->type != dst->type) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target video card model %s does not match source %s"),
                        virDomainVideoTypeToString(dst->type),
                        virDomainVideoTypeToString(src->type));
-        goto cleanup;
+        return false;
     }

     if (src->vram != dst->vram) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target video card vram %u does not match source %u"),
                        dst->vram, src->vram);
-        goto cleanup;
+        return false;
     }

     if (src->heads != dst->heads) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target video card heads %u does not match source %u"),
                        dst->heads, src->heads);
-        goto cleanup;
+        return false;
     }

     if ((src->accel && !dst->accel) ||
         (!src->accel && dst->accel)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("Target video card acceleration does not match source"));
-        goto cleanup;
+        return false;
     }

     if (src->accel) {
@@ -11343,24 +11304,21 @@ virDomainVideoDefCheckABIStability(virDomainVideoDefPtr src,
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Target video card 2d accel %u does not match source %u"),
                            dst->accel->support2d, src->accel->support2d);
-            goto cleanup;
+            return false;
         }

         if (src->accel->support3d != dst->accel->support3d) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Target video card 3d accel %u does not match source %u"),
                            dst->accel->support3d, src->accel->support3d);
-            goto cleanup;
+            return false;
         }
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11368,33 +11326,27 @@ static bool
 virDomainHostdevDefCheckABIStability(virDomainHostdevDefPtr src,
                                      virDomainHostdevDefPtr dst)
 {
-    bool identical = false;
-
     if (src->mode != dst->mode) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target host device mode %s does not match source %s"),
                        virDomainHostdevModeTypeToString(dst->mode),
                        virDomainHostdevModeTypeToString(src->mode));
-        goto cleanup;
+        return false;
     }

-    if (src->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
-        if (src->source.subsys.type != dst->source.subsys.type) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("Target host device subsystem %s does not match source %s"),
-                           virDomainHostdevSubsysTypeToString(dst->source.subsys.type),
-                           virDomainHostdevSubsysTypeToString(src->source.subsys.type));
-            goto cleanup;
-        }
+    if (src->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
+        src->source.subsys.type != dst->source.subsys.type) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target host device subsystem %s does not match source %s"),
+                       virDomainHostdevSubsysTypeToString(dst->source.subsys.type),
+                       virDomainHostdevSubsysTypeToString(src->source.subsys.type));
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(src->info, dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11402,15 +11354,10 @@ static bool
 virDomainSmartcardDefCheckABIStability(virDomainSmartcardDefPtr src,
                                        virDomainSmartcardDefPtr dst)
 {
-    bool identical = false;
-
     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11418,22 +11365,17 @@ static bool
 virDomainSerialDefCheckABIStability(virDomainChrDefPtr src,
                                     virDomainChrDefPtr dst)
 {
-    bool identical = false;
-
     if (src->target.port != dst->target.port) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target serial port %d does not match source %d"),
                        dst->target.port, src->target.port);
-        goto cleanup;
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11441,22 +11383,17 @@ static bool
 virDomainParallelDefCheckABIStability(virDomainChrDefPtr src,
                                       virDomainChrDefPtr dst)
 {
-    bool identical = false;
-
     if (src->target.port != dst->target.port) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target serial port %d does not match source %d"),
                        dst->target.port, src->target.port);
-        goto cleanup;
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11464,14 +11401,12 @@ static bool
 virDomainChannelDefCheckABIStability(virDomainChrDefPtr src,
                                      virDomainChrDefPtr dst)
 {
-    bool identical = false;
-
     if (src->targetType != dst->targetType) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target channel type %s does not match source %s"),
                        virDomainChrChannelTargetTypeToString(dst->targetType),
                        virDomainChrChannelTargetTypeToString(src->targetType));
-        goto cleanup;
+        return false;
     }

     switch (src->targetType) {
@@ -11480,7 +11415,7 @@ virDomainChannelDefCheckABIStability(virDomainChrDefPtr src,
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("Target channel name %s does not match source %s"),
                            NULLSTR(dst->target.name), NULLSTR(src->target.name));
-            goto cleanup;
+            return false;
         }
         if (src->source.type != dst->source.type &&
             (src->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC ||
@@ -11489,7 +11424,7 @@ virDomainChannelDefCheckABIStability(virDomainChrDefPtr src,
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("Changing device type to/from spicevmc would"
                              " change default target channel name"));
-            goto cleanup;
+            return false;
         }
         break;
     case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
@@ -11502,18 +11437,15 @@ virDomainChannelDefCheckABIStability(virDomainChrDefPtr src,
                            NULLSTR(daddr), NULLSTR(saddr));
             VIR_FREE(saddr);
             VIR_FREE(daddr);
-            goto cleanup;
+            return false;
         }
         break;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11521,23 +11453,18 @@ static bool
 virDomainConsoleDefCheckABIStability(virDomainChrDefPtr src,
                                      virDomainChrDefPtr dst)
 {
-    bool identical = false;
-
     if (src->targetType != dst->targetType) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target console type %s does not match source %s"),
                        virDomainChrConsoleTargetTypeToString(dst->targetType),
                        virDomainChrConsoleTargetTypeToString(src->targetType));
-        goto cleanup;
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11545,23 +11472,18 @@ static bool
 virDomainWatchdogDefCheckABIStability(virDomainWatchdogDefPtr src,
                                       virDomainWatchdogDefPtr dst)
 {
-    bool identical = false;
-
     if (src->model != dst->model) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target watchdog model %s does not match source %s"),
                        virDomainWatchdogModelTypeToString(dst->model),
                        virDomainWatchdogModelTypeToString(src->model));
-        goto cleanup;
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11569,23 +11491,18 @@ static bool
 virDomainMemballoonDefCheckABIStability(virDomainMemballoonDefPtr src,
                                         virDomainMemballoonDefPtr dst)
 {
-    bool identical = false;
-
     if (src->model != dst->model) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target balloon model %s does not match source %s"),
                        virDomainMemballoonModelTypeToString(dst->model),
                        virDomainMemballoonModelTypeToString(src->model));
-        goto cleanup;
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


@@ -11593,23 +11510,18 @@ static bool
 virDomainHubDefCheckABIStability(virDomainHubDefPtr src,
                                  virDomainHubDefPtr dst)
 {
-    bool identical = false;
-
     if (src->type != dst->type) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target hub device type %s does not match source %s"),
                        virDomainHubTypeToString(dst->type),
                        virDomainHubTypeToString(src->type));
-        goto cleanup;
+        return false;
     }

     if (!virDomainDeviceInfoCheckABIStability(&src->info, &dst->info))
-        goto cleanup;
-
-    identical = true;
+        return false;

-cleanup:
-    return identical;
+    return true;
 }

 static bool
@@ -11617,14 +11529,13 @@ virDomainRedirFilterDefCheckABIStability(virDomainRedirFilterDefPtr src,
                                          virDomainRedirFilterDefPtr dst)
 {
     int i;
-    bool identical = false;

     if (src->nusbdevs != dst->nusbdevs) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target USB redirection filter rule "
                          "count %zu does not match source %zu"),
                          dst->nusbdevs, src->nusbdevs);
-        goto cleanup;
+        return false;
     }

     for (i = 0; i < src->nusbdevs; i++) {
@@ -11633,25 +11544,25 @@ virDomainRedirFilterDefCheckABIStability(virDomainRedirFilterDefPtr src,
         if (srcUsbDev->usbClass != dstUsbDev->usbClass) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            "%s", _("Target USB Class code does not match source"));
-            goto cleanup;
+            return false;
         }

         if (srcUsbDev->vendor != dstUsbDev->vendor) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            "%s", _("Target USB vendor ID does not match source"));
-            goto cleanup;
+            return false;
         }

         if (srcUsbDev->product != dstUsbDev->product) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            "%s", _("Target USB product ID does not match source"));
-            goto cleanup;
+            return false;
         }

         if (srcUsbDev->version != dstUsbDev->version) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            "%s", _("Target USB version does not match source"));
-            goto cleanup;
+            return false;
         }

         if (srcUsbDev->allow != dstUsbDev->allow) {
@@ -11659,13 +11570,11 @@ virDomainRedirFilterDefCheckABIStability(virDomainRedirFilterDefPtr src,
                            _("Target USB allow '%s' does not match source '%s'"),
                              dstUsbDev->allow ? "yes" : "no",
                              srcUsbDev->allow ? "yes" : "no");
-            goto cleanup;
+            return false;
         }
     }
-    identical = true;

-cleanup:
-    return identical;
+    return true;
 }

 /* This compares two configurations and looks for any differences
@@ -11676,7 +11585,6 @@ bool
 virDomainDefCheckABIStability(virDomainDefPtr src,
                               virDomainDefPtr dst)
 {
-    bool identical = false;
     int i;

     if (src->virtType != dst->virtType) {
@@ -11684,7 +11592,7 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
                        _("Target domain virt type %s does not match source %s"),
                        virDomainVirtTypeToString(dst->virtType),
                        virDomainVirtTypeToString(src->virtType));
-        goto cleanup;
+        return false;
     }

     if (memcmp(src->uuid, dst->uuid, VIR_UUID_BUFLEN) != 0) {
@@ -11695,60 +11603,60 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain uuid %s does not match source %s"),
                        uuiddst, uuidsrc);
-        goto cleanup;
+        return false;
     }

     if (src->mem.max_balloon != dst->mem.max_balloon) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain max memory %lld does not match source %lld"),
                        dst->mem.max_balloon, src->mem.max_balloon);
-        goto cleanup;
+        return false;
     }
     if (src->mem.cur_balloon != dst->mem.cur_balloon) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain current memory %lld does not match source %lld"),
                        dst->mem.cur_balloon, src->mem.cur_balloon);
-        goto cleanup;
+        return false;
     }
     if (src->mem.hugepage_backed != dst->mem.hugepage_backed) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain huge page backing %d does not match source %d"),
                        dst->mem.hugepage_backed,
                        src->mem.hugepage_backed);
-        goto cleanup;
+        return false;
     }

     if (src->vcpus != dst->vcpus) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain vpu count %d does not match source %d"),
                        dst->vcpus, src->vcpus);
-        goto cleanup;
+        return false;
     }
     if (src->maxvcpus != dst->maxvcpus) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain vpu max %d does not match source %d"),
                        dst->maxvcpus, src->maxvcpus);
-        goto cleanup;
+        return false;
     }

     if (STRNEQ(src->os.type, dst->os.type)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain OS type %s does not match source %s"),
                        dst->os.type, src->os.type);
-        goto cleanup;
+        return false;
     }
     if (src->os.arch != dst->os.arch){
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain architecture %s does not match source %s"),
                        virArchToString(dst->os.arch),
                        virArchToString(src->os.arch));
-        goto cleanup;
+        return false;
     }
     if (STRNEQ(src->os.machine, dst->os.machine)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain OS type %s does not match source %s"),
                        dst->os.machine, src->os.machine);
-        goto cleanup;
+        return false;
     }

     if (src->os.smbios_mode != dst->os.smbios_mode) {
@@ -11756,227 +11664,250 @@ virDomainDefCheckABIStability(virDomainDefPtr src,
                        _("Target domain SMBIOS mode %s does not match source %s"),
                        virDomainSmbiosModeTypeToString(dst->os.smbios_mode),
                        virDomainSmbiosModeTypeToString(src->os.smbios_mode));
-        goto cleanup;
+        return false;
     }

     if (src->features != dst->features) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain features %d does not match source %d"),
                        dst->features, src->features);
-        goto cleanup;
+        return false;
     }

     if (src->clock.ntimers != dst->clock.ntimers) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("Target domain timers do not match source"));
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->clock.ntimers ; i++) {
-        if (!virDomainTimerDefCheckABIStability(src->clock.timers[i], dst->clock.timers[i]))
-            goto cleanup;
+        if (!virDomainTimerDefCheckABIStability(src->clock.timers[i],
+                                                dst->clock.timers[i]))
+            return false;
     }

     if (!virCPUDefIsEqual(src->cpu, dst->cpu))
-        goto cleanup;
+        return false;

     if (!virSysinfoIsEqual(src->sysinfo, dst->sysinfo))
-        goto cleanup;
+        return false;

     if (src->ndisks != dst->ndisks) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("Target domain disk count %zu does not match source %zu"),
                        dst->ndisks, src->ndisks);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->ndisks ; i++)
         if (!virDomainDiskDefCheckABIStability(src->disks[i], dst->disks[i]))
-            goto cleanup;
+            return false;

     if (src->ncontrollers != dst->ncontrollers) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain disk controller count %zu does not match source %zu"),
+                       _("Target domain disk controller count %zu "
+                         "does not match source %zu"),
                        dst->ncontrollers, src->ncontrollers);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->ncontrollers ; i++)
-        if (!virDomainControllerDefCheckABIStability(src->controllers[i], dst->controllers[i]))
-            goto cleanup;
+        if (!virDomainControllerDefCheckABIStability(src->controllers[i],
+                                                     dst->controllers[i]))
+            return false;

     if (src->nfss != dst->nfss) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain filesystem count %zu does not match source %zu"),
+                       _("Target domain filesystem count %zu "
+                         "does not match source %zu"),
                        dst->nfss, src->nfss);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->nfss ; i++)
         if (!virDomainFsDefCheckABIStability(src->fss[i], dst->fss[i]))
-            goto cleanup;
+            return false;

     if (src->nnets != dst->nnets) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain net card count %zu does not match source %zu"),
+                       _("Target domain net card count %zu "
+                         "does not match source %zu"),
                        dst->nnets, src->nnets);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->nnets ; i++)
         if (!virDomainNetDefCheckABIStability(src->nets[i], dst->nets[i]))
-            goto cleanup;
+            return false;

     if (src->ninputs != dst->ninputs) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain input device count %zu does not match source %zu"),
+                       _("Target domain input device count %zu "
+                         "does not match source %zu"),
                        dst->ninputs, src->ninputs);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->ninputs ; i++)
         if (!virDomainInputDefCheckABIStability(src->inputs[i], dst->inputs[i]))
-            goto cleanup;
+            return false;

     if (src->nsounds != dst->nsounds) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain sound card count %zu does not match source %zu"),
+                       _("Target domain sound card count %zu "
+                         "does not match source %zu"),
                        dst->nsounds, src->nsounds);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->nsounds ; i++)
         if (!virDomainSoundDefCheckABIStability(src->sounds[i], dst->sounds[i]))
-            goto cleanup;
+            return false;

     if (src->nvideos != dst->nvideos) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain video card count %zu does not match source %zu"),
+                       _("Target domain video card count %zu "
+                         "does not match source %zu"),
                        dst->nvideos, src->nvideos);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->nvideos ; i++)
         if (!virDomainVideoDefCheckABIStability(src->videos[i], dst->videos[i]))
-            goto cleanup;
+            return false;

     if (src->nhostdevs != dst->nhostdevs) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain host device count %zu does not match source %zu"),
+                       _("Target domain host device count %zu "
+                         "does not match source %zu"),
                        dst->nhostdevs, src->nhostdevs);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->nhostdevs ; i++)
-        if (!virDomainHostdevDefCheckABIStability(src->hostdevs[i], dst->hostdevs[i]))
-            goto cleanup;
+        if (!virDomainHostdevDefCheckABIStability(src->hostdevs[i],
+                                                  dst->hostdevs[i]))
+            return false;

     if (src->nsmartcards != dst->nsmartcards) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain smartcard count %zu does not match source %zu"),
+                       _("Target domain smartcard count %zu "
+                         "does not match source %zu"),
                        dst->nsmartcards, src->nsmartcards);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->nsmartcards ; i++)
-        if (!virDomainSmartcardDefCheckABIStability(src->smartcards[i], dst->smartcards[i]))
-            goto cleanup;
+        if (!virDomainSmartcardDefCheckABIStability(src->smartcards[i],
+                                                    dst->smartcards[i]))
+            return false;

     if (src->nserials != dst->nserials) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain serial port count %zu does not match source %zu"),
+                       _("Target domain serial port count %zu "
+                         "does not match source %zu"),
                        dst->nserials, src->nserials);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->nserials ; i++)
-        if (!virDomainSerialDefCheckABIStability(src->serials[i], dst->serials[i]))
-            goto cleanup;
+        if (!virDomainSerialDefCheckABIStability(src->serials[i],
+                                                 dst->serials[i]))
+            return false;

     if (src->nparallels != dst->nparallels) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain parallel port count %zu does not match source %zu"),
+                       _("Target domain parallel port count %zu "
+                         "does not match source %zu"),
                        dst->nparallels, src->nparallels);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->nparallels ; i++)
-        if (!virDomainParallelDefCheckABIStability(src->parallels[i], dst->parallels[i]))
-            goto cleanup;
+        if (!virDomainParallelDefCheckABIStability(src->parallels[i],
+                                                   dst->parallels[i]))
+            return false;

     if (src->nchannels != dst->nchannels) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain channel count %zu does not match source %zu"),
+                       _("Target domain channel count %zu "
+                         "does not match source %zu"),
                        dst->nchannels, src->nchannels);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->nchannels ; i++)
-        if (!virDomainChannelDefCheckABIStability(src->channels[i], dst->channels[i]))
-            goto cleanup;
+        if (!virDomainChannelDefCheckABIStability(src->channels[i],
+                                                  dst->channels[i]))
+            return false;

     if (src->nconsoles != dst->nconsoles) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain console count %zu does not match source %zu"),
+                       _("Target domain console count %zu "
+                         "does not match source %zu"),
                        dst->nconsoles, src->nconsoles);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->nconsoles ; i++)
-        if (!virDomainConsoleDefCheckABIStability(src->consoles[i], dst->consoles[i]))
-            goto cleanup;
+        if (!virDomainConsoleDefCheckABIStability(src->consoles[i],
+                                                  dst->consoles[i]))
+            return false;

     if (src->nhubs != dst->nhubs) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain hub device count %zu does not match source %zu"),
+                       _("Target domain hub device count %zu "
+                         "does not match source %zu"),
                        dst->nhubs, src->nhubs);
-        goto cleanup;
+        return false;
     }

     for (i = 0 ; i < src->nhubs ; i++)
         if (!virDomainHubDefCheckABIStability(src->hubs[i], dst->hubs[i]))
-            goto cleanup;
+            return false;

     if ((!src->redirfilter && dst->redirfilter) ||
         (src->redirfilter && !dst->redirfilter)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain USB redirection filter count %d does not match source %d"),
+                       _("Target domain USB redirection filter count %d "
+                         "does not match source %d"),
                        dst->redirfilter ? 1 : 0, src->redirfilter ? 1 : 0);
-        goto cleanup;
+        return false;
     }

     if (src->redirfilter &&
-        !virDomainRedirFilterDefCheckABIStability(src->redirfilter, dst->redirfilter))
-        goto cleanup;
+        !virDomainRedirFilterDefCheckABIStability(src->redirfilter,
+                                                  dst->redirfilter))
+        return false;

     if ((!src->watchdog && dst->watchdog) ||
         (src->watchdog && !dst->watchdog)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain watchdog count %d does not match source %d"),
+                       _("Target domain watchdog count %d "
+                         "does not match source %d"),
                        dst->watchdog ? 1 : 0, src->watchdog ? 1 : 0);
-        goto cleanup;
+        return false;
     }

     if (src->watchdog &&
         !virDomainWatchdogDefCheckABIStability(src->watchdog, dst->watchdog))
-        goto cleanup;
+        return false;

     if ((!src->memballoon && dst->memballoon) ||
         (src->memballoon && !dst->memballoon)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                       _("Target domain memory balloon count %d does not match source %d"),
+                       _("Target domain memory balloon count %d "
+                         "does not match source %d"),
                        dst->memballoon ? 1 : 0, src->memballoon ? 1 : 0);
-        goto cleanup;
+        return false;
     }

     if (src->memballoon &&
-        !virDomainMemballoonDefCheckABIStability(src->memballoon, dst->memballoon))
-        goto cleanup;
-
-    identical = true;
+        !virDomainMemballoonDefCheckABIStability(src->memballoon,
+                                                 dst->memballoon))
+        return false;

-cleanup:
-    return identical;
+    return true;
 }


-- 
1.8.1.1

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


[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]