
Heidi Eckhart wrote:
Jay Gagnon wrote:
diff -r 60ecfe23d68c -r 7feaabeb36ce instance_util.c --- a/instance_util.c Tue Feb 05 16:01:32 2008 -0500 +++ b/instance_util.c Thu Feb 07 16:36:40 2008 -0500 @@ -251,6 +251,27 @@ CMPIInstance *cu_dup_instance(const CMPI
out: return dest; +} + +char *classname_from_inst(const CMPIBroker *broker, + CMPIInstance *inst, + CMPIStatus *s) +{ + char *ret = NULL; + + CMPIObjectPath *ref; + ref = CMGetObjectPath(inst, s); + if ((s->rc != CMPI_RC_OK) || CMIsNullObject(ref)) { + cu_statusf(broker, s, + CMPI_RC_ERR_FAILED, + "Could not get objectpath from instance"); + goto out; + } + + ret = strdup(CLASSNAME(ref)); + + out: + return ret; }
/* diff -r 60ecfe23d68c -r 7feaabeb36ce libcmpiutil.h --- a/libcmpiutil.h Tue Feb 05 16:01:32 2008 -0500 +++ b/libcmpiutil.h Thu Feb 07 16:36:40 2008 -0500 @@ -413,6 +413,19 @@ CMPIStatus cu_validate_ref(const CMPIBro CMPIStatus cu_validate_ref(const CMPIBroker *broker, const CMPIObjectPath *ref, const CMPIInstance *inst); + +/** + * Returns the classname from an instance without forcing user to get + * ObjectPath first. + * + * @param broker A pointer to the current broker + * @param inst Instance to examine + * @param s An out pointer for returning status if error occurs + * @returns Classname of instance (must be freed), NULL on failure + */ +char *classname_from_inst(const CMPIBroker *broker, + CMPIInstance *inst, + CMPIStatus *s);
#define DEFAULT_EIN(pn) \ static CMPIStatus pn##EnumInstanceNames(CMPIInstanceMI *self, \
Please let me play the PatchCO today - is this really part of the indication patch ;) ?
Touche! :) No, you're right, it doesn't really belong. I unfortunately sent these two out in a bit of a rush right before I left yesterday, so I spent all of 30 seconds scanning for patch quality. I'm sure there are a bunch of little things, and I promise they'll be fixed in the next version, but for the most part I'm just looking for a sanity check here. Just want to make sure that I'm not doing something really crazy before I invest much more time into this. -- -Jay