[libvirt] [PATCH] nwfiler: Return error message about unresolvable variables

Eric Blake eblake at redhat.com
Mon Jun 27 15:52:02 UTC 2011


On 06/27/2011 08:14 AM, Stefan Berger wrote:

s/nwfiler/nwfilter/ in the subject

> This is in response to bugzilla 664629
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=664629
> 
> The patch below returns an appropriate error message if the chain of
> nwfilters is found to contain unresolvable variables and therefore
> cannot be instantiated.
> 
> +
> +static void
> +_printString(void *payload ATTRIBUTE_UNUSED, const void *name, void *data)

I'm not a fan of leading underscore.  That shouldn't be necessary -
marking the function static is good enough without having to also munge
the name.  s/_printString/printString/g

> +/**
> + * virNWFilterPrintVars
> + *
> + * @var: hash table containing variables
> + * @separaptro: separator to use between variable names, i.e., ", "

s/separaptro/separator/

> +err_unresolvable_vars:
> +
> +    buf = virNWFilterPrintVars(missing_vars->hashTable, ", ", false, false);
> +    if (buf) {
> +        virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
> +                   _("Cannot instantiate filter due to unresolvable "
> +                     "variable%s: %s"),
> +                   strstr(buf, ", ") ? "s" : "",

This is unfair to translators.  Appending 's' is not always the proper
way to create a plural.  Rather, you must use:

> +                   buf);

virNWFilterReportError(VIR_ERR_INTERNAL_ERROR,
                       strstr(buf, ", ") ?
 _("Cannot instantiate filter due to unresolvable variables: %s") :
 _("Cannot instantiate filter due to unresolvable variable: %s"),
                       buf);

ACK with those changes.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list