DS> +static int compare_prop(const CMPIObjectPath *ref,
DS> + const CMPIInstance *inst,
DS> + const char *name,
DS> + int mandatory)
DS> +{
DS> + char *prop = NULL;
DS> + char *key = NULL;
DS> + int rc = 0;
DS> +
DS> + key = cu_get_str_path(ref, name);
DS> + if (key == NULL) {
DS> + rc = !mandatory;
DS> + goto out;
DS> + }
DS> +
DS> + if (cu_get_str_prop(inst, name, &prop) != CMPI_RC_OK)
DS> + goto out;
DS> +
DS> + rc = STREQ(key, prop);
DS> + out:
DS> + free(prop);
DS> + free(key);
DS> +
DS> + return rc;
DS> +}
I think that some variation of the above function probably deserves to
be in libcmpiutil. The act of comparing an instance with a reference
and make sure that all keys are either correct or unspecified seems
like a common thing. There are probably other places where we need
such a filter anyway. Thoughts?
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms(a)us.ibm.com