Re: [PATCH 2/3] Add sentinel for virErrorDomain enum

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

 



On 05/15/2012 05:30 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
> 
> Add a VIR_ERR_DOMAIN_LAST sentinel for virErrorDomain and
> replace the virErrorDomainName function by a VIR_ENUM_IMPL
> 
> In the process the naming of error domains is santized

s/santized/sanitized/

> 
> * src/util/virterror.c: Use VIR_ENUM_IMPL for converting
>   error domains to strings
> * include/libvirt/virterror.h: Add VIR_ERR_DOMAIN_LAST
> ---
>  include/libvirt/virterror.h |   13 +++
>  src/util/virterror.c        |  219 +++++++++++++------------------------------
>  2 files changed, 78 insertions(+), 154 deletions(-)
> 

Oh my - I dug through my old branches, and saw that I tried (and failed)
to do this type of cleanup 18 months ago.  Your version is cleaner than
my attempt; I like it.

>  
>  /*
> @@ -585,7 +496,7 @@ virDefaultErrorFunc(virErrorPtr err)
>              lvl = _("error");
>              break;
>      }
> -    dom = virErrorDomainName(err->domain);
> +    dom = virErrorDomainTypeToString(err->domain);

You are missing a check for dom==NULL (possible if a newer server sends
an error domain we are not familiar with); you should have a catch-all
case that converts NULL to "Unknown".

ACK with that tweak.

-- 
Eric Blake   eblake@xxxxxxxxxx    +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]