Re: [libvirt] [PATCH 2/3] virutil: Introduce virEnumFromString

2015-09-22 Thread Daniel P. Berrange
On Thu, Sep 17, 2015 at 05:31:28PM +0200, Michal Privoznik wrote: > So, now we have VIR_ENUM_DECL() and VIR_ENUM_IMPL() macros. They > will define a pair of functions for you to convert from and to > certain enum. Unfortunately, their usage is slightly cumbersome: > > int tmp; > virMyAwesome m

Re: [libvirt] [PATCH 2/3] virutil: Introduce virEnumFromString

2015-09-22 Thread John Ferlan
On 09/17/2015 11:31 AM, Michal Privoznik wrote: > So, now we have VIR_ENUM_DECL() and VIR_ENUM_IMPL() macros. They > will define a pair of functions for you to convert from and to > certain enum. Unfortunately, their usage is slightly cumbersome: > > int tmp; > virMyAwesome ma; > > if ((t

[libvirt] [PATCH 2/3] virutil: Introduce virEnumFromString

2015-09-17 Thread Michal Privoznik
So, now we have VIR_ENUM_DECL() and VIR_ENUM_IMPL() macros. They will define a pair of functions for you to convert from and to certain enum. Unfortunately, their usage is slightly cumbersome: int tmp; virMyAwesome ma; if ((tmp = virMyAwesomeTypeFromString(str)) < 0) { virReportError(