[Libvirt-cim] [PATCH] GetInstance() does not return an instance that matches the instanceID given

Dan Smith danms at us.ibm.com
Tue Dec 11 21:15:47 UTC 2007


KR> +        if (get_instance) {
KR> +                if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) {
KR> +                        cu_statusf(_BROKER, &s,
KR> +                                   CMPI_RC_ERR_FAILED,
KR> +                                   "No InstanceID specified");
KR> +                        goto out;
KR> +                }
KR> +        }

How about we move this to the actual GetInstance() function?  That
will avoid the double-nest.

Then pass an id, or NULL if none, instead of the boolean. That makes
this drop the first level of nesting as well:

KR> +                if (get_instance) {
KR> +                        if (!STREQ(name, id))
KR> +                                goto end;
KR> +                }
KR> +

Shouldn't add anything redundant and would be much cleaner, IMHO.
What do you think?

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20071211/2ef14119/attachment.sig>


More information about the Libvirt-cim mailing list