conf: make error returns from virDomainActualNetDefFormat consistent

There was an error: label that simply did "return ret", but ret was
defaulted to -1, and was never used other than setting it manually to
0 just before a non-error return. Aside from this, some of the error
return paths used "goto error" and others used "return ret".

This patch removes ret and the error: label, and makes all error
returns just consistently do "return -1".
This commit is contained in:
Laine Stump 2012-07-30 00:47:44 -04:00
parent 1d1744285b
commit 2841a0ad0f

View File

@ -11546,7 +11546,6 @@ virDomainActualNetDefFormat(virBufferPtr buf,
virDomainActualNetDefPtr def, virDomainActualNetDefPtr def,
unsigned int flags) unsigned int flags)
{ {
int ret = -1;
const char *type; const char *type;
const char *mode; const char *mode;
@ -11557,7 +11556,7 @@ virDomainActualNetDefFormat(virBufferPtr buf,
if (!type) { if (!type) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected net type %d"), def->type); _("unexpected net type %d"), def->type);
return ret; return -1;
} }
virBufferAsprintf(buf, " <actual type='%s'", type); virBufferAsprintf(buf, " <actual type='%s'", type);
@ -11584,7 +11583,7 @@ virDomainActualNetDefFormat(virBufferPtr buf,
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected source mode %d"), _("unexpected source mode %d"),
def->data.direct.mode); def->data.direct.mode);
return ret; return -1;
} }
virBufferAsprintf(buf, " mode='%s'/>\n", mode); virBufferAsprintf(buf, " mode='%s'/>\n", mode);
break; break;
@ -11603,21 +11602,18 @@ virDomainActualNetDefFormat(virBufferPtr buf,
default: default:
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected net type %s"), type); _("unexpected net type %s"), type);
goto error; return -1;
} }
virBufferAdjustIndent(buf, 8); virBufferAdjustIndent(buf, 8);
if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0) if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0)
return -1; return -1;
if (virNetDevBandwidthFormat(def->bandwidth, buf) < 0) if (virNetDevBandwidthFormat(def->bandwidth, buf) < 0)
goto error; return -1;
virBufferAdjustIndent(buf, -8); virBufferAdjustIndent(buf, -8);
virBufferAddLit(buf, " </actual>\n"); virBufferAddLit(buf, " </actual>\n");
return 0;
ret = 0;
error:
return ret;
} }
static int static int