[libvirt] [PATCH] maint: Kill usage of atoi()
Peter Krempa
pkrempa at redhat.com
Thu Nov 14 16:22:54 UTC 2013
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131114/a97113b7/attachment-0001.sig>
More information about the libvir-list
mailing list