[libvirt] [PATCH 2/3] Add sentinel for virErrorDomain enum

Eric Blake eblake at redhat.com
Wed May 16 22:57:24 UTC 2012


On 05/15/2012 05:30 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> 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 at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120516/1f4c9e4f/attachment-0001.sig>


More information about the libvir-list mailing list