> - 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(a)us.ibm.com