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

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Tue Dec 11 21:18:48 UTC 2007


Dan Smith wrote:
> 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?
>   
Yes, that's a much cleaner approach.  =)  Will send out an updated patch.

-- 
Kaitlin Rupert
IBM Linux Technology Center
karupert at us.ibm.com





More information about the Libvirt-cim mailing list