Re: [libvirt] PATCH: Helper for enumerations

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

 



On Sun, Jun 15, 2008 at 11:55:10PM +0200, Jim Meyering wrote:
> "Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
> > There are quite a few places in our code where we have to convert from
> > a string to an int enumeration, and vica-verca. This is tedious code to
> > write, and I'm about to introduce a tonne more enumerations in the new
> > generic domain XML parser / generator. So I reckon its time for some
> > helper APIs
> ...
> 
> Very nice.  That's been annoying me for some time.
> ACK
> 
> > diff -r bc1615919490 src/util.c
> > --- a/src/util.c	Fri Jun 13 15:43:20 2008 +0100
> > +++ b/src/util.c	Fri Jun 13 18:52:39 2008 +0100
> > @@ -798,3 +798,24 @@
> >      return idx;
> >  }
> >
> > +int virEnumFromString(const char *const*types,
> > +                      int ntypes,
> 
> If using an unsigned type (size_t or unsigned int) doesn't cause too
> much disruption among the callers, that'd be nice, since negative
> "ntypes" is not useful.

Yep, unsigned int works just fine, so I've made that change and
committed the patch.

Regards
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 :|

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