
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1196179380 28800 # Node ID dce4d8a891849228a59d3f90b4b2d30dc098fc3a # Parent dca4cb9c22da97bfef6c2771bf082efbd6d32bc4 Fixes to misc_util for libcmpiutil API change Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r dca4cb9c22da -r dce4d8a89184 libxkutil/misc_util.c --- a/libxkutil/misc_util.c Tue Nov 27 10:34:13 2007 +0100 +++ b/libxkutil/misc_util.c Tue Nov 27 08:03:00 2007 -0800 @@ -85,15 +85,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) @@ -316,7 +319,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) { @@ -350,15 +353,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 dca4cb9c22da -r dce4d8a89184 libxkutil/misc_util.h --- a/libxkutil/misc_util.h Tue Nov 27 10:34:13 2007 +0100 +++ b/libxkutil/misc_util.h Tue Nov 27 08:03:00 2007 -0800 @@ -83,7 +83,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); @@ -93,7 +93,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);