[Libvirt-cim] [PATCH 06 of 18] Fixes to VSMS for libcmpiutil API change

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


>> -                cu_get_str_prop(inst, "NetworkType", &dev->dev.net.type);
>> -                if (dev->dev.net.type == NULL)
>> -                        dev->dev.net.type = strdup("bridge");
>> +                dev->dev.net.type = strdup(val);

KR> I'm not as familiar with the device support as a I should be.  =)
KR> It looks like your removing support for the NULL case here.  Is
KR> returning the network type of "bridge" in the NULL case no longer
KR> valid?

No, that case is still handled.  For full context:

+                if (cu_get_str_prop(inst, "NetworkType", &val) != CMPI_RC_OK)
+                        val = "bridge";
+
                 free(dev->dev.net.type);
-                cu_get_str_prop(inst, "NetworkType", &dev->dev.net.type);
-                if (dev->dev.net.type == NULL)
-                        dev->dev.net.type = strdup("bridge");
+                dev->dev.net.type = strdup(val);

I moved the "not set" (NULL) case above, and set val to "bridge", so
that below, I can assume it is a valid const string and strdup it
directly.  So val either gets the actual type, or "bridge" by the time
I get to the strdup.

I did the same reordering in disk with the Address field, making
"/dev/null" the default if unspecified.

-- 
Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvirt-cim/attachments/20071128/7d3b0516/attachment.sig>


More information about the Libvirt-cim mailing list