]> xenbits.xensource.com Git - libvirt.git/commitdiff
tools: remove unneeded cleanup labels
authorDaniel Henrique Barboza <danielhb413@gmail.com>
Mon, 21 Oct 2019 18:19:09 +0000 (15:19 -0300)
committerJán Tomko <jtomko@redhat.com>
Tue, 12 Nov 2019 16:54:01 +0000 (17:54 +0100)
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
tools/virsh-completer-network.c
tools/virsh-domain.c
tools/vsh.c

index 0097fca7ccc1a99af93dc9bd11311ab0a5bac641..8f0048ed6f84ce5ebfc9031047ba85b9d1d3cc5e 100644 (file)
@@ -74,21 +74,17 @@ virshNetworkEventNameCompleter(vshControl *ctl G_GNUC_UNUSED,
                                unsigned int flags)
 {
     size_t i = 0;
-    char **ret = NULL;
     VIR_AUTOSTRINGLIST tmp = NULL;
 
     virCheckFlags(0, NULL);
 
     if (VIR_ALLOC_N(tmp, VIR_NETWORK_EVENT_ID_LAST + 1) < 0)
-        goto cleanup;
+        return NULL;
 
     for (i = 0; i < VIR_NETWORK_EVENT_ID_LAST; i++)
         tmp[i] = g_strdup(virshNetworkEventCallbacks[i].name);
 
-    ret = g_steal_pointer(&tmp);
-
- cleanup:
-    return ret;
+    return g_steal_pointer(&tmp);
 }
 
 
index fadc0b8206e70b6b162219a1f7bd3539f46209d7..0feb21ef17760e21b6a27e35f00b04e24bb05d0f 100644 (file)
@@ -2571,7 +2571,6 @@ virshBlockJobInfo(vshControl *ctl,
     virshControlPtr priv = ctl->privData;
     unsigned long long speed;
     unsigned int flags = 0;
-    bool ret = false;
     int rc = -1;
 
     /* If bytes were requested, or if raw mode is not forcing a MiB/s
@@ -2593,7 +2592,7 @@ virshBlockJobInfo(vshControl *ctl,
                 }
                 G_GNUC_FALLTHROUGH;
             default:
-                goto cleanup;
+                return false;
             }
         }
         speed = info.bandwidth;
@@ -2602,7 +2601,7 @@ virshBlockJobInfo(vshControl *ctl,
     if (rc < 0) {
         flags &= ~VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES;
         if ((rc = virDomainGetBlockJobInfo(dom, path, &info, flags)) < 0)
-            goto cleanup;
+            return false;
         speed = info.bandwidth;
         /* Scale to bytes/s unless in raw mode */
         if (!raw) {
@@ -2610,7 +2609,7 @@ virshBlockJobInfo(vshControl *ctl,
             if (speed >> 20 != info.bandwidth) {
                 vshError(ctl, _("overflow in converting %ld MiB/s to bytes\n"),
                          info.bandwidth);
-                goto cleanup;
+                return false;
             }
         }
     }
@@ -2618,8 +2617,7 @@ virshBlockJobInfo(vshControl *ctl,
     if (rc == 0) {
         if (!raw)
             vshPrintExtra(ctl, _("No current block job for %s"), path);
-        ret = true;
-        goto cleanup;
+        return true;
     }
 
     if (raw) {
@@ -2638,10 +2636,7 @@ virshBlockJobInfo(vshControl *ctl,
         vshPrint(ctl, "\n");
     }
 
-    ret = true;
-
- cleanup:
-    return ret;
+    return true;
 }
 
 
@@ -2982,34 +2977,31 @@ cmdRunConsole(vshControl *ctl, virDomainPtr dom,
               const char *name,
               unsigned int flags)
 {
-    bool ret = false;
     int state;
     virshControlPtr priv = ctl->privData;
 
     if ((state = virshDomainState(ctl, dom, NULL)) < 0) {
         vshError(ctl, "%s", _("Unable to get domain status"));
-        goto cleanup;
+        return false;
     }
 
     if (state == VIR_DOMAIN_SHUTOFF) {
         vshError(ctl, "%s", _("The domain is not running"));
-        goto cleanup;
+        return false;
     }
 
     if (!isatty(STDIN_FILENO)) {
         vshError(ctl, "%s", _("Cannot run interactive console without a controlling TTY"));
-        goto cleanup;
+        return false;
     }
 
     vshPrintExtra(ctl, _("Connected to domain %s\n"), virDomainGetName(dom));
     vshPrintExtra(ctl, _("Escape character is %s\n"), priv->escapeChar);
     fflush(stdout);
     if (virshRunConsole(ctl, dom, name, flags) == 0)
-        ret = true;
-
- cleanup:
+        return true;
 
-    return ret;
+    return false;
 }
 
 static bool
@@ -5044,7 +5036,7 @@ cmdSchedInfoUpdateOne(vshControl *ctl,
                                         field, param->type,
                                         value) < 0) {
             vshSaveLibvirtError();
-            goto cleanup;
+            return -1;
         }
         ret = 0;
         break;
@@ -5053,7 +5045,6 @@ cmdSchedInfoUpdateOne(vshControl *ctl,
     if (ret < 0)
         vshError(ctl, _("invalid scheduler option: %s"), field);
 
- cleanup:
     return ret;
 }
 
@@ -9708,26 +9699,22 @@ static bool
 cmdQemuAttach(vshControl *ctl, const vshCmd *cmd)
 {
     virDomainPtr dom = NULL;
-    bool ret = false;
     unsigned int flags = 0;
     unsigned int pid_value; /* API uses unsigned int, not pid_t */
     virshControlPtr priv = ctl->privData;
 
     if (vshCommandOptUInt(ctl, cmd, "pid", &pid_value) <= 0)
-        goto cleanup;
+        return false;
 
     if (!(dom = virDomainQemuAttach(priv->conn, pid_value, flags))) {
         vshError(ctl, _("Failed to attach to pid %u"), pid_value);
-        goto cleanup;
+        return false;
     }
 
     vshPrintExtra(ctl, _("Domain %s attached to pid %u\n"),
                   virDomainGetName(dom), pid_value);
     virshDomainFree(dom);
-    ret = true;
-
- cleanup:
-    return ret;
+    return true;
 }
 
 /*
index 271d18a5223f1f53e831fd84f4daa5abbb5f1fb4..000cf6a009b43386cc98b8cb00d2329bf3edf4dd 100644 (file)
@@ -2514,7 +2514,6 @@ vshTreePrintInternal(vshControl *ctl,
 {
     size_t i;
     int nextlastdev = -1;
-    int ret = -1;
     const char *dev = (lookup)(devid, false, opaque);
 
     /* Print this device, with indent if not at root */
@@ -2548,7 +2547,7 @@ vshTreePrintInternal(vshControl *ctl,
             vshTreePrintInternal(ctl, lookup, opaque,
                                  num_devices, i, nextlastdev,
                                  false, indent) < 0)
-            goto cleanup;
+            return -1;
     }
     virBufferTrim(indent, "  ", -1);
 
@@ -2559,9 +2558,8 @@ vshTreePrintInternal(vshControl *ctl,
 
     if (!root)
         virBufferTrim(indent, NULL, 2);
-    ret = 0;
- cleanup:
-    return ret;
+
+    return 0;
 }
 
 int