
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1196272229 28800 # Node ID cc0d80e1229bbd45e62c409336ce6020fbdebdbf # Parent f230e4d57a78a48efb5c32e70e048ce229c2cca4 Fixes to misc_util for libcmpiutil API change Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r f230e4d57a78 -r cc0d80e1229b libxkutil/misc_util.c --- a/libxkutil/misc_util.c Wed Nov 28 11:27:09 2007 +0100 +++ b/libxkutil/misc_util.c Wed Nov 28 09:50:29 2007 -0800 @@ -86,15 +86,18 @@ void free_domain_list(virDomainPtr *list virDomainFree(list[i]); } -char *get_key_from_ref_arg(const CMPIArgs *args, char *arg, char *key) +const char *get_key_from_ref_arg(const CMPIArgs *args, char *arg, char *key) { CMPIObjectPath *ref = NULL; - - ref = cu_get_ref_arg(args, arg); - if (ref == NULL) - return NULL; - - return cu_get_str_path(ref, key); + const char *val = NULL; + + if (cu_get_ref_arg(args, arg, &ref) != CMPI_RC_OK) + return NULL; + + if (cu_get_str_path(ref, key, &val) != CMPI_RC_OK) + return NULL; + + return val; } bool domain_exists(virConnectPtr conn, const char *name) @@ -352,7 +355,7 @@ bool domain_online(virDomainPtr dom) (info.state == VIR_DOMAIN_RUNNING); } -int parse_id(char *id, +int parse_id(const char *id, char **pfx, char **name) { @@ -386,15 +389,12 @@ bool parse_instanceid(const CMPIObjectPa char **name) { int ret; - char *id = NULL; - - id = cu_get_str_path(ref, "InstanceID"); - if (id == NULL) + const char *id = NULL; + + if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) return false; ret = parse_id(id, pfx, name); - - free(id); if (!ret) return false; diff -r f230e4d57a78 -r cc0d80e1229b libxkutil/misc_util.h --- a/libxkutil/misc_util.h Wed Nov 28 11:27:09 2007 +0100 +++ b/libxkutil/misc_util.h Wed Nov 28 09:50:29 2007 -0800 @@ -84,7 +84,7 @@ CMPIInstance *get_typed_instance(const C /* Parse an OrgID:LocID string into its constituent parts */ int parse_instance_id(char *iid, char **orgid, char **locid); -char *get_key_from_ref_arg(const CMPIArgs *args, char *arg, char *key); +const char *get_key_from_ref_arg(const CMPIArgs *args, char *arg, char *key); bool domain_exists(virConnectPtr conn, const char *name); bool domain_online(virDomainPtr dom); @@ -94,7 +94,7 @@ char *association_prefix(const char *pro char *association_prefix(const char *provider_name); bool match_pn_to_cn(const char *pn, const char *cn); -int parse_id(char *id, char **pfx, char **name); +int parse_id(const char *id, char **pfx, char **name); bool parse_instanceid(const CMPIObjectPath *ref, char **pfx, char **name); bool libvirt_cim_init(void);