Re: [PATCH] maint: Kill usage of atoi()

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

 



On 11/14/13 17:20, Peter Krempa wrote:
> Also fix a typo in variable name holding the cylinders count of a disk
> pool (apparently unused).
> ---
>  cfg.mk                             | 10 ++++++++++
>  src/conf/storage_conf.h            |  2 +-
>  src/qemu/qemu_command.c            |  8 ++++++--
>  src/storage/storage_backend_disk.c | 16 +++++++++++-----
>  src/xen/xend_internal.c            | 17 +++++++++++++----
>  5 files changed, 41 insertions(+), 12 deletions(-)
> 

...

> diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
> index 4e53ec5..1f30b06 100644
> --- a/src/storage/storage_backend_disk.c
> +++ b/src/storage/storage_backend_disk.c
> @@ -280,12 +280,18 @@ virStorageBackendDiskMakePoolGeometry(virStoragePoolObjPtr pool,
>                                        char **const groups,
>                                        void *data ATTRIBUTE_UNUSED)
>  {
> +    pool = pool;
> +    groups = groups;

Hmm, I forgot to commit removal of this test statements :/

Consider this squashed in:
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 1f30b06..a7a7d0e 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -280,8 +280,6 @@ virStorageBackendDiskMakePoolGeometry(virStoragePoolObjPtr pool,
                                       char **const groups,
                                       void *data ATTRIBUTE_UNUSED)
 {
-    pool = pool;
-    groups = groups;
     virStoragePoolSourceDevicePtr device = &(pool->def->source.devices[0]);
     if (virStrToLong_i(groups[0], NULL, 0, &device->geometry.cylinders) < 0 ||
         virStrToLong_i(groups[1], NULL, 0, &device->geometry.heads) < 0 ||



> +    virStoragePoolSourceDevicePtr device = &(pool->def->source.devices[0]);
> +    if (virStrToLong_i(groups[0], NULL, 0, &device->geometry.cylinders) < 0 ||
> +        virStrToLong_i(groups[1], NULL, 0, &device->geometry.heads) < 0 ||
> +        virStrToLong_i(groups[2], NULL, 0, &device->geometry.sectors) < 0) {
> +        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
> +                       _("Failed to create disk pool geometry"));
> +        return -1;
> +    }
> 
> -       pool->def->source.devices[0].geometry.cyliders = atoi(groups[0]);
> -       pool->def->source.devices[0].geometry.heads = atoi(groups[1]);
> -       pool->def->source.devices[0].geometry.sectors = atoi(groups[2]);
> -
> -       return 0;
> +    return 0;
>  }
> 

Peter


Attachment: signature.asc
Description: OpenPGP digital signature

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