]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
remove useless code
authorJim Meyering <meyering@redhat.com>
Thu, 5 Feb 2009 16:03:11 +0000 (16:03 +0000)
committerJim Meyering <meyering@redhat.com>
Thu, 5 Feb 2009 16:03:11 +0000 (16:03 +0000)
* src/bridge.c (brAddTap): Remove redundant errno=ENOMEM assignment
after failed strdup.
* src/cgroup.c (virCgroupFree): Remove redundant *group=NULL assignment
after VIR_FREE(*group).
* src/lxc_driver.c (lxcShutdown): Likewise.
* src/xen_unified.c (xenUnifiedClose): Likewise.
* src/xm_internal.c (xenXMDomainConfigFormat): Rewrite disk-
and net-config-setting code to be clearer.

ChangeLog
src/bridge.c
src/cgroup.c
src/lxc_driver.c
src/xen_unified.c
src/xm_internal.c

index 207854eab528ef4f216f6d1301451f5b5145b36f..b046a774b780576242c4c4fd8b71e557cb9b4e42 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Thu Feb 5 17:00:17 +0100 2009 Jim Meyering <meyering@redhat.com>
+
+       remove useless code
+       * src/bridge.c (brAddTap): Remove redundant errno=ENOMEM assignment
+       after failed strdup.
+       * src/cgroup.c (virCgroupFree): Remove redundant *group=NULL assignment
+       after VIR_FREE(*group).
+       * src/lxc_driver.c (lxcShutdown): Likewise.
+       * src/xen_unified.c (xenUnifiedClose): Likewise.
+       * src/xm_internal.c (xenXMDomainConfigFormat): Rewrite disk-
+       and net-config-setting code to be clearer.
+
 Wed Feb 4 22:22:34 +0100 2009 Jim Meyering <meyering@redhat.com>
 
        lxc_container: Don't dereference NULL upon failure
index 9c4ca7422a287962617eab4de1f25101a8893f87..990a5679d30092ff336d62d8de6e69d72a1612c4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Red Hat, Inc.
+ * Copyright (C) 2007, 2009 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -539,10 +539,8 @@ brAddTap(brControl *ctl,
             if ((errno = brSetInterfaceUp(ctl, try.ifr_name, 1)))
                 goto error;
             VIR_FREE(*ifname);
-            if (!(*ifname = strdup(try.ifr_name))) {
-                errno = ENOMEM;
+            if (!(*ifname = strdup(try.ifr_name)))
                 goto error;
-            }
             *tapfd = fd;
             return 0;
         }
index 1b4c27f77859178f485d620b4f007086b61e790c..8bd6e87309fc5ce971f81cd8ecfcf762007931ff 100644 (file)
@@ -51,7 +51,6 @@ void virCgroupFree(virCgroupPtr *group)
     if (*group != NULL) {
         VIR_FREE((*group)->path);
         VIR_FREE(*group);
-        *group = NULL;
     }
 }
 
index 87865053ffb8aed17cfe83db7ac28d32fc96f1e5..aa417a91fae8a0cd15a5254697358687701c3fea 100644 (file)
@@ -1238,7 +1238,6 @@ static int lxcShutdown(void)
     lxcDriverUnlock(lxc_driver);
     virMutexDestroy(&lxc_driver->lock);
     VIR_FREE(lxc_driver);
-    lxc_driver = NULL;
 
     return 0;
 }
index eefdb6c15c684f73e2a0358c248f37690f513d2b..8e64f51118391ad0b28c4ed9c0cb62257dc21159 100644 (file)
@@ -399,7 +399,6 @@ xenUnifiedClose (virConnectPtr conn)
 
     virMutexDestroy(&priv->lock);
     VIR_FREE(conn->privateData);
-    conn->privateData = NULL;
 
     return 0;
 }
index a03263c40f14aac0013ca98c113bf2fdda3d7477..3a96058d721f0729036c3c1731e3804a815cbe7d 100644 (file)
@@ -2233,14 +2233,13 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
                                         hvm, priv->xendConfigVersion) < 0)
             goto cleanup;
     }
-    if (diskVal->list == NULL)
-        VIR_FREE(diskVal);
-    else if (virConfSetValue(conf, "disk", diskVal) < 0) {
+    if (diskVal->list != NULL) {
+        int ret = virConfSetValue(conf, "disk", diskVal);
         diskVal = NULL;
-        goto no_memory;
+        if (ret < 0)
+            goto no_memory;
     }
-    diskVal = NULL;
-
+    VIR_FREE(diskVal);
 
     if (VIR_ALLOC(netVal) < 0)
         goto no_memory;
@@ -2253,13 +2252,13 @@ virConfPtr xenXMDomainConfigFormat(virConnectPtr conn,
                                        hvm) < 0)
             goto cleanup;
     }
-    if (netVal->list == NULL)
-        VIR_FREE(netVal);
-    else if (virConfSetValue(conf, "vif", netVal) < 0) {
+    if (netVal->list != NULL) {
+        int ret = virConfSetValue(conf, "vif", netVal);
         netVal = NULL;
-        goto no_memory;
+        if (ret < 0)
+            goto no_memory;
     }
-    netVal = NULL;
+    VIR_FREE(netVal);
 
     if (hvm) {
         if (def->nparallels) {