[PATCH] Removing pre-existing parse InstanceID function (parse_instance_id()). This function should have been used instead of writing a new one, however, it doesn't support NULL parameters for the prefix and the local_id

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1195499749 28800 # Node ID a38c8fc56e5787d3cadde11cccba37cbfc6926ac # Parent f3e1a5e15e27a2014a9fc382a40d74d476eaa76d Removing pre-existing parse InstanceID function (parse_instance_id()). This function should have been used instead of writing a new one, however, it doesn't support NULL parameters for the prefix and the local_id. Also replacing any calls to parse_instance_id() and replaced with parse_instanceid(). Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r f3e1a5e15e27 -r a38c8fc56e57 libxkutil/misc_util.c --- a/libxkutil/misc_util.c Mon Nov 19 10:08:54 2007 -0800 +++ b/libxkutil/misc_util.c Mon Nov 19 11:15:49 2007 -0800 @@ -155,29 +155,6 @@ bool match_pn_to_cn(const char *pn, cons return result; } -int parse_instance_id(char *_iid, char **orgid, char **locid) -{ - char *iid = NULL; - char *delim = NULL; - int ret = 0; - - iid = strdup(_iid); - - delim = strchr(iid, ':'); - if (!delim) { - free(iid); - goto out; - } - - *delim = '\0'; - *orgid = iid; - *locid = strdup(delim+1); - - ret = 1; - out: - return ret; -} - static const char *prefix_from_uri(const char *uri) { if (strstr(uri, "xen")) diff -r f3e1a5e15e27 -r a38c8fc56e57 src/Virt_VSSD.c --- a/src/Virt_VSSD.c Mon Nov 19 10:08:54 2007 -0800 +++ b/src/Virt_VSSD.c Mon Nov 19 11:15:49 2007 -0800 @@ -223,23 +223,12 @@ static CMPIStatus GetInstance(CMPIInstan { CMPIStatus s; CMPIInstance *inst; - char *iid; - char *orgid; char *locid; - iid = cu_get_str_path(reference, "InstanceID"); - if (iid == NULL) { - CMSetStatusWithChars(_BROKER, &s, - CMPI_RC_ERR_FAILED, - "InstanceID not specified"); - return s; - } - - if (!parse_instance_id(iid, &orgid, &locid)) { - CMSetStatusWithChars(_BROKER, &s, - CMPI_RC_ERR_FAILED, + if (!parse_instanceid(reference, NULL, &locid)) { + cu_statusf(_BROKER, &s, + CMPI_RC_ERR_FAILED, "Invalid InstanceID specified"); - free(iid); return s; } @@ -249,8 +238,6 @@ static CMPIStatus GetInstance(CMPIInstan CMSetStatus(&s, CMPI_RC_OK); - free(iid); - free(orgid); free(locid); return s;

KR> Removing pre-existing parse InstanceID function KR> (parse_instance_id()). Doh! That was my bad :) Applied. -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com
participants (2)
-
Dan Smith
-
Kaitlin Rupert