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(a)redhat.com>
---
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