[Libvirt-cim] [PATCH 15 of 17] Fixes to RAFP for libcmpiutil API change

Dan Smith danms at us.ibm.com
Wed Nov 28 17:10:28 UTC 2007


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1196273390 28800
# Node ID 7d60f525a9732ff3635001565ae0ef8b72b38eb7
# Parent  e8350716e6731e00ba1d7e093d9cdef696a9f9bb
Fixes to RAFP for libcmpiutil API change

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r e8350716e673 -r 7d60f525a973 src/Virt_ResourceAllocationFromPool.c
--- a/src/Virt_ResourceAllocationFromPool.c	Wed Nov 28 10:09:50 2007 -0800
+++ b/src/Virt_ResourceAllocationFromPool.c	Wed Nov 28 10:09:50 2007 -0800
@@ -43,7 +43,7 @@ static CMPIStatus rasd_to_pool(const CMP
 {
         CMPIStatus s;
         uint16_t type;
-        char *id = NULL;
+        const char *id = NULL;
         char *poolid = NULL;
         virConnectPtr conn = NULL;
         struct inst_list _list;
@@ -58,8 +58,7 @@ static CMPIStatus rasd_to_pool(const CMP
                 goto out;
         }
 
-        id = cu_get_str_path(ref, "InstanceID");
-        if (id == NULL) {
+        if (cu_get_str_path(ref, "InstanceID", &id) != CMPI_RC_OK) {
                 cu_statusf(_BROKER, &s,
                            CMPI_RC_ERR_FAILED,
                            "Missing InstanceID");
@@ -92,7 +91,6 @@ static CMPIStatus rasd_to_pool(const CMP
         }
 
  out:
-        free(id);
         free(poolid);
         virConnectClose(conn);
         inst_list_free(&_list);
@@ -106,7 +104,7 @@ static int filter_by_pool(struct inst_li
 {
         int i;
         uint16_t type;
-        char *rasd_id = NULL;
+        const char *rasd_id = NULL;
         char *poolid = NULL;
 
         for (i = 0; i < src->cur; i++) {
@@ -126,8 +124,6 @@ static int filter_by_pool(struct inst_li
                 poolid = pool_member_of(_BROKER, CLASSNAME(op), type, rasd_id);
                 if (STREQ(poolid, _poolid))
                         inst_list_add(dest, inst);
-
-                free(rasd_id);
         }
 
         return dest->cur;
@@ -182,10 +178,9 @@ static CMPIStatus pool_to_rasd(const CMP
                                struct inst_list *list)
 {
         CMPIStatus s;
-        char *poolid;
-
-        poolid = cu_get_str_path(ref, "InstanceID");
-        if (poolid == NULL) {
+        const char *poolid;
+
+        if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) {
                 cu_statusf(_BROKER, &s,
                            CMPI_RC_ERR_FAILED,
                            "Missing InstanceID");
@@ -222,8 +217,6 @@ static CMPIStatus pool_to_rasd(const CMP
         CMSetStatus(&s, CMPI_RC_OK);
 
  out:
-        free(poolid);
-
         return s;
 }
 




More information about the Libvirt-cim mailing list