On 05/03/2013 08:53 AM, Michal Privoznik wrote:
---
src/hyperv/hyperv_driver.c | 50 ++++++++++------------------------------------
src/hyperv/hyperv_util.c | 18 +++++------------
2 files changed, 15 insertions(+), 53 deletions(-)
@@ -908,21 +895,12 @@ hypervDomainGetXMLDesc(virDomainPtr domain,
unsigned int flags)
return NULL;
}
- def->name = strdup(computerSystem->data->ElementName);
-
- if (def->name == NULL) {
- virReportOOMError();
+ if (VIR_STRDUP(def->name, computerSystem->data->ElementName) < 0)
goto cleanup;
- }
-
- if (virtualSystemSettingData->data->Notes != NULL) {
- def->description = strdup(virtualSystemSettingData->data->Notes);
- if (def->description == NULL) {
- virReportOOMError();
- goto cleanup;
- }
- }
+ if (virtualSystemSettingData->data->Notes &&
+ VIR_STRDUP(def->description, virtualSystemSettingData->data->Notes)
< 0)
Could be simplified by allowing a NULL source (and this time, I actually
posted that proposal:
https://www.redhat.com/archives/libvir-list/2013-May/msg00458.html)
ACK.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org