Re: [PATCH 3/3] virSecurityLabelDef: use enum type for @type

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

 



On 07/11/2014 03:32 AM, Michal Privoznik wrote:
> There's this trend in libvirt of using enum types wherever possible.
> Now that I'm at virSecurityLabelDef let's rework @type item of the
> structure so we don't have to typecast it elsewhere.
> 
> Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c      | 6 ++++--
>  src/security/security_dac.c | 2 +-
>  src/util/virseclabel.h      | 2 +-
>  3 files changed, 6 insertions(+), 4 deletions(-)

I'm not quite as sure about this one.  This solves the issue of how to
detect errors when parsing strings to enum, but required the use of an
intermediate variable which in turn made the patch a net gain in lines
of code.  If someone forgets to use the intermediate variable for
parsing, this backfires.  On the other hand, parsing string to enum
should be done in just one location, and that's the location touched by
this patch.  I'm 50-50 on whether to take this, so I'd like someone else
to chime in with an opinion.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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