]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Remove unnecessary check for non-NULL uuid
authorJiri Denemark <jdenemar@redhat.com>
Thu, 17 Jun 2010 14:45:27 +0000 (16:45 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 21 Jun 2010 08:11:34 +0000 (10:11 +0200)
The first thing we do in all these functions is to check uuid != NULL
and fail if it isn't.

src/datatypes.c

index 20b2d74cc87f6674319b6e54f06d52b8db60680d..8750406b08b46e19d5642a3df4abb57a0e41aa17 100644 (file)
@@ -369,8 +369,7 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
         ret->magic = VIR_DOMAIN_MAGIC;
         ret->conn = conn;
         ret->id = -1;
-        if (uuid != NULL)
-            memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);
+        memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);
         ret->snapshots = virHashCreate(20);
 
         if (virHashAddEntry(conn->domains, uuidstr, ret) < 0) {
@@ -515,8 +514,7 @@ virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid) {
         }
         ret->magic = VIR_NETWORK_MAGIC;
         ret->conn = conn;
-        if (uuid != NULL)
-            memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);
+        memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);
 
         if (virHashAddEntry(conn->networks, uuidstr, ret) < 0) {
             virMutexUnlock(&conn->lock);
@@ -837,8 +835,7 @@ virGetStoragePool(virConnectPtr conn, const char *name, const unsigned char *uui
         }
         ret->magic = VIR_STORAGE_POOL_MAGIC;
         ret->conn = conn;
-        if (uuid != NULL)
-            memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);
+        memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);
 
         if (virHashAddEntry(conn->storagePools, uuidstr, ret) < 0) {
             virMutexUnlock(&conn->lock);
@@ -1452,8 +1449,7 @@ virGetNWFilter(virConnectPtr conn, const char *name, const unsigned char *uuid)
         }
         ret->magic = VIR_NWFILTER_MAGIC;
         ret->conn = conn;
-        if (uuid != NULL)
-            memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);
+        memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);
 
         if (virHashAddEntry(conn->nwfilterPools, uuidstr, ret) < 0) {
             virMutexUnlock(&conn->lock);