Re: [libvirt] [PATCH] parse container id in separate function

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

 



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@xxxxxxxxxx  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

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