
On Fri, Jul 18, 2008 at 07:16:25PM +0100, Daniel P. Berrange wrote:
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.
Right, let's reuse it, but I notice we are using strtol() in a lot of places ...openvz driver is not the worse here especially since it has already an encapsulating function. Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/