[libvirt] [PATCH] parse container id in separate function
Daniel P. Berrange
berrange at redhat.com
Fri Jul 18 18:16:25 UTC 2008
On Fri, Jul 18, 2008 at 06:02:00PM +0400, Evgeniy Sokolov wrote:
> There were several places with parsing container id from code.
> Separate function is used now.
> Index: src/openvz_conf.c
> ===================================================================
> RCS file: /data/cvs/libvirt/src/openvz_conf.c,v
> retrieving revision 1.29
> diff -u -p -r1.29 openvz_conf.c
> --- src/openvz_conf.c 11 Jul 2008 08:56:16 -0000 1.29
> +++ src/openvz_conf.c 18 Jul 2008 13:21:07 -0000
> @@ -134,9 +134,7 @@ strtoI(const char *str)
> val = (int) strtol(str, &endptr, base);
>
> /* Check for various possible errors */
> - if ((endptr == str) /* "No digits were found" */
> - ||((*endptr != '\0')
> - && (*endptr != ' ')) /*"Name contain characters other than integers" */ )
> + if (endptr == str) /* "No digits were found" */
> return 0;
> return val;
> }
I'd not noticed this function before, but it looks like you could
probably just call virStrToLong_i() from the util.h file.
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
More information about the libvir-list
mailing list