JG> +CMPIStatus cu_dup_instance(const CMPIBroker *broker,
JG> + CMPIInstance *src,
JG> + CMPIInstance **dest)
JG> +{
JG> + CMPIStatus s = {CMPI_RC_OK, NULL};
JG> + CMPIObjectPath *ref;
JG> +
JG> + ref = CMGetObjectPath(src, NULL);
JG> + if ((s.rc != CMPI_RC_OK) || CMIsNullObject(ref)) {
JG> + cu_statusf(broker, &s,
JG> + CMPI_RC_ERR_FAILED,
JG> + "Could not get objectpath from instance");
JG> + goto out;
JG> + }
JG> +
JG> + *dest = NULL;
Why set it to NULL and then set it to the instance right after this?
JG> + *dest = CMNewInstance(broker, ref, &s);
JG> +
JG> + out:
JG> + return s;
JG> +}
What about all the properties of the instance? This gets a new
instance structure, yes, but all it has is an object path. Maybe that
is all you need at the moment, but I don't think this does what other
consumers of the library would think by the name :)
It should be easy to loop through all the properties and copy them
over. It will look similar to the array copy/filter code in Kaitlin's
libcmpiutil CO patch.
--
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms(a)us.ibm.com