Signed-off-by: Laine Stump <laine@xxxxxxxxxx> --- src/libxl/libxl_conf.c | 11 ++++------- src/libxl/xen_common.c | 16 +++++----------- src/libxl/xen_xl.c | 25 ++++++++----------------- src/libxl/xen_xm.c | 7 ++----- 4 files changed, 19 insertions(+), 40 deletions(-) diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index fe8ad4a3cb..02cc5e6f1b 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -910,7 +910,6 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src, const char *username, const char *secret) { - char *ret = NULL; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; size_t i; @@ -931,14 +930,14 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src, virReportError(VIR_ERR_NO_SUPPORT, _("Unsupported network block protocol '%s'"), virStorageNetProtocolTypeToString(src->protocol)); - goto cleanup; + return NULL; case VIR_STORAGE_NET_PROTOCOL_RBD: if (strchr(src->path, ':')) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("':' not allowed in RBD source volume name '%s'"), src->path); - goto cleanup; + return NULL; } virBufferStrcat(&buf, "rbd:", src->volume, "/", src->path, NULL); @@ -973,12 +972,10 @@ libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src, if (src->configFile) virBufferEscape(&buf, '\\', ":", ":conf=%s", src->configFile); - ret = virBufferContentAndReset(&buf); - break; + return virBufferContentAndReset(&buf); } - cleanup: - return ret; + return NULL; } static int diff --git a/src/libxl/xen_common.c b/src/libxl/xen_common.c index 6b16752c8a..475c64f944 100644 --- a/src/libxl/xen_common.c +++ b/src/libxl/xen_common.c @@ -1640,13 +1640,13 @@ xenFormatSerial(virConfValuePtr list, virDomainChrDefPtr serial) if (serial) { ret = xenFormatSxprChr(serial, &buf); if (ret < 0) - goto cleanup; + return -1; } else { virBufferAddLit(&buf, "none"); } if (VIR_ALLOC(val) < 0) - goto cleanup; + return -1; val->type = VIR_CONF_STRING; val->str = virBufferContentAndReset(&buf); @@ -1659,9 +1659,6 @@ xenFormatSerial(virConfValuePtr list, virDomainChrDefPtr serial) list->list = val; return 0; - - cleanup: - return -1; } char * @@ -1781,12 +1778,12 @@ xenFormatNet(virConnectPtr conn, case VIR_DOMAIN_NET_TYPE_USER: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported net type '%s'"), virDomainNetTypeToString(net->type)); - goto cleanup; + return -1; case VIR_DOMAIN_NET_TYPE_LAST: default: virReportEnumRangeError(virDomainNetType, net->type); - goto cleanup; + return -1; } if (virDomainNetGetModelString(net)) { @@ -1810,7 +1807,7 @@ xenFormatNet(virConnectPtr conn, virBufferAsprintf(&buf, ",rate=%lluKB/s", net->bandwidth->out->average); if (VIR_ALLOC(val) < 0) - goto cleanup; + return -1; val->type = VIR_CONF_STRING; val->str = virBufferContentAndReset(&buf); @@ -1823,9 +1820,6 @@ xenFormatNet(virConnectPtr conn, list->list = val; return 0; - - cleanup: - return -1; } diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index 4baf5e336e..b81c5d23ce 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -1412,11 +1412,10 @@ static int xenFormatXLVnode(virConfValuePtr list, virBufferPtr buf) { - int ret = -1; virConfValuePtr numaPnode, tmp; if (VIR_ALLOC(numaPnode) < 0) - goto cleanup; + return -1; /* Place VNODE directive */ numaPnode->type = VIR_CONF_STRING; @@ -1429,10 +1428,8 @@ xenFormatXLVnode(virConfValuePtr list, tmp->next = numaPnode; else list->list = numaPnode; - ret = 0; - cleanup: - return ret; + return 0; } static int @@ -1561,7 +1558,6 @@ xenFormatXLXenbusLimits(virConfPtr conf, virDomainDefPtr def) static char * xenFormatXLDiskSrcNet(virStorageSourcePtr src) { - char *ret = NULL; g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER; size_t i; @@ -1582,14 +1578,14 @@ xenFormatXLDiskSrcNet(virStorageSourcePtr src) virReportError(VIR_ERR_NO_SUPPORT, _("Unsupported network block protocol '%s'"), virStorageNetProtocolTypeToString(src->protocol)); - goto cleanup; + return NULL; case VIR_STORAGE_NET_PROTOCOL_RBD: if (strchr(src->path, ':')) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("':' not allowed in RBD source volume name '%s'"), src->path); - goto cleanup; + return NULL; } virBufferStrcat(&buf, "rbd:", src->volume, "/", src->path, NULL); @@ -1614,12 +1610,10 @@ xenFormatXLDiskSrcNet(virStorageSourcePtr src) } } - ret = virBufferContentAndReset(&buf); - break; + return virBufferContentAndReset(&buf); } - cleanup: - return ret; + return NULL; } @@ -2111,14 +2105,14 @@ xenFormatXLChannel(virConfValuePtr list, virDomainChrDefPtr channel) channel->source->data.nix.path); break; default: - goto cleanup; + return -1; } /* name */ virBufferAsprintf(&buf, "name=%s", channel->target.name); if (VIR_ALLOC(val) < 0) - goto cleanup; + return -1; val->type = VIR_CONF_STRING; val->str = virBufferContentAndReset(&buf); @@ -2130,9 +2124,6 @@ xenFormatXLChannel(virConfValuePtr list, virDomainChrDefPtr channel) else list->list = val; return 0; - - cleanup: - return -1; } static int diff --git a/src/libxl/xen_xm.c b/src/libxl/xen_xm.c index f28326ade8..81b64a2fb4 100644 --- a/src/libxl/xen_xm.c +++ b/src/libxl/xen_xm.c @@ -322,7 +322,7 @@ xenFormatXMDisk(virConfValuePtr list, virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported disk type %s"), virStorageTypeToString(virDomainDiskGetType(disk))); - goto cleanup; + return -1; } } virBufferAdd(&buf, src, -1); @@ -346,7 +346,7 @@ xenFormatXMDisk(virConfValuePtr list, } if (VIR_ALLOC(val) < 0) - goto cleanup; + return -1; val->type = VIR_CONF_STRING; val->str = virBufferContentAndReset(&buf); @@ -359,9 +359,6 @@ xenFormatXMDisk(virConfValuePtr list, list->list = val; return 0; - - cleanup: - return -1; } -- 2.25.4