Re: [PATCH 2/4] Remove unnecessary check for non-NULL uuid

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

 



2010/6/17 Jiri Denemark <jdenemar@xxxxxxxxxx>:
> The first thing we do in all these functions is to check uuid != NULL
> and fail if it isn't.
> ---
>  src/datatypes.c |   12 ++++--------
>  1 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/src/datatypes.c b/src/datatypes.c
> index 20b2d74..8750406 100644
> --- a/src/datatypes.c
> +++ b/src/datatypes.c
> @@ -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);

We might also get rid of this unnecessary unreferencing and
referencing while touching those 3 memcpys and replace

  memcpy(&(ret->uuid[0]), uuid, VIR_UUID_BUFLEN);

with

  memcpy(ret->uuid, uuid, VIR_UUID_BUFLEN);

ACK.

Matthias

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