[Libvirt-cim] [PATCH 1 of 2] [CU] Add dup_instance function to libcmpiutil
Jay Gagnon
grendel at linux.vnet.ibm.com
Tue Feb 5 21:31:20 UTC 2008
Jay Gagnon wrote:
> + for (i = 0; i < prop_count; i++) {
> + CMPIString *prop;
> + char *prop_name;
> +
> + data = CMGetPropertyAt(src, i, &prop, s);
> + prop_name = CMGetCharPtr(prop);
> + if (s->rc != CMPI_RC_OK) {
> + goto out;
> + }
> +
> + *s = CMSetProperty(dest, prop_name,
> + &(data.value), data.type);
> + if (s->rc != CMPI_RC_OK) {
> + goto out;
> + }
> + }
> +
> + out:
> + return dest;
> }
>
>
It's probably worth pointing out that CMGetCharPtr simply does the
casting for me; there is no strdup, so I believe it is not necessary to
free prop_name here. I only say this because up until today when I
looked it up, if I saw someone using CMGetCharPtr, I would have asked
where the free is.
--
-Jay
More information about the Libvirt-cim
mailing list