
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