mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
util: remove unneeded labels
Remove unneeded, easy to remove goto labels (cleanup|error|done|...). Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
ce56408e5f
commit
a3645a4747
@ -1119,7 +1119,7 @@ virHostCPUGetThreadsPerSubcore(virArch arch)
|
||||
* In either case, falling back to the subcore-unaware thread
|
||||
* counting logic is the right thing to do */
|
||||
if (!virFileExists(KVM_DEVICE))
|
||||
goto out;
|
||||
return 0;
|
||||
|
||||
if ((kvmfd = open(KVM_DEVICE, O_RDONLY)) < 0) {
|
||||
/* This can happen when running as a regular user if
|
||||
@ -1129,8 +1129,7 @@ virHostCPUGetThreadsPerSubcore(virArch arch)
|
||||
virReportSystemError(errno,
|
||||
_("Failed to open '%s'"),
|
||||
KVM_DEVICE);
|
||||
threads_per_subcore = -1;
|
||||
goto out;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* For Phyp and KVM based guests the ioctl for KVM_CAP_PPC_SMT
|
||||
@ -1143,7 +1142,6 @@ virHostCPUGetThreadsPerSubcore(virArch arch)
|
||||
VIR_FORCE_CLOSE(kvmfd);
|
||||
}
|
||||
|
||||
out:
|
||||
return threads_per_subcore;
|
||||
}
|
||||
|
||||
|
@ -823,7 +823,6 @@ virNetDevGetRcvAllMulti(const char *ifname,
|
||||
char *virNetDevGetName(int ifindex)
|
||||
{
|
||||
char name[IFNAMSIZ];
|
||||
char *ifname = NULL;
|
||||
|
||||
memset(&name, 0, sizeof(name));
|
||||
|
||||
@ -831,13 +830,10 @@ char *virNetDevGetName(int ifindex)
|
||||
virReportSystemError(errno,
|
||||
_("Failed to convert interface index %d to a name"),
|
||||
ifindex);
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ifname = g_strdup(name);
|
||||
|
||||
cleanup:
|
||||
return ifname;
|
||||
return g_strdup(name);
|
||||
}
|
||||
#else
|
||||
char *virNetDevGetName(int ifindex)
|
||||
@ -1702,7 +1698,7 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac,
|
||||
if (!tb[IFLA_VFINFO_LIST]) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("missing IFLA_VF_INFO in netlink response"));
|
||||
goto cleanup;
|
||||
return rc;
|
||||
}
|
||||
|
||||
nla_for_each_nested(tb_vf_info, tb[IFLA_VFINFO_LIST], rem) {
|
||||
@ -1713,7 +1709,7 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac,
|
||||
ifla_vf_policy)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("error parsing IFLA_VF_INFO"));
|
||||
goto cleanup;
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (mac && tb[IFLA_VF_MAC]) {
|
||||
@ -1739,7 +1735,6 @@ virNetDevParseVfConfig(struct nlattr **tb, int32_t vf, virMacAddrPtr mac,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("couldn't find IFLA_VF_INFO for VF %d "
|
||||
"in netlink response"), vf);
|
||||
cleanup:
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -1156,7 +1156,7 @@ int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname,
|
||||
linkdev, vmuuid,
|
||||
virtPortProfile, vmOp);
|
||||
if (rc < 0)
|
||||
goto error;
|
||||
return rc;
|
||||
|
||||
ignore_value(virNetDevVPortProfileAssociate(cr_ifname,
|
||||
virtPortProfile,
|
||||
@ -1166,7 +1166,6 @@ int virNetDevMacVLanRestartWithVPortProfile(const char *cr_ifname,
|
||||
vmuuid,
|
||||
vmOp, true));
|
||||
|
||||
error:
|
||||
return rc;
|
||||
|
||||
}
|
||||
|
@ -514,16 +514,16 @@ virNetDevTapAttachBridge(const char *tapname,
|
||||
*/
|
||||
if (mtu > 0) {
|
||||
if (virNetDevSetMTU(tapname, mtu) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
} else {
|
||||
if (virNetDevSetMTUFromDevice(tapname, brname) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
if (actualMTU) {
|
||||
int retMTU = virNetDevGetMTU(tapname);
|
||||
|
||||
if (retMTU < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
|
||||
*actualMTU = retMTU;
|
||||
}
|
||||
@ -532,21 +532,18 @@ virNetDevTapAttachBridge(const char *tapname,
|
||||
if (virtPortProfile) {
|
||||
if (virtPortProfile->virtPortType == VIR_NETDEV_VPORT_PROFILE_MIDONET) {
|
||||
if (virNetDevMidonetBindPort(tapname, virtPortProfile) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
} else if (virtPortProfile->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) {
|
||||
if (virNetDevOpenvswitchAddPort(brname, tapname, macaddr, vmuuid,
|
||||
virtPortProfile, virtVlan) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (virNetDevBridgeAddPort(brname, tapname) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -518,7 +518,6 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf,
|
||||
bool is8021Qbg,
|
||||
uint16_t *status)
|
||||
{
|
||||
int rc = -1;
|
||||
struct nlattr *tb_port[IFLA_PORT_MAX + 1] = { NULL, };
|
||||
|
||||
if (vf == PORT_SELF_VF && nltarget_kernel) {
|
||||
@ -527,12 +526,12 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf,
|
||||
ifla_port_policy)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("error parsing IFLA_PORT_SELF part"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("IFLA_PORT_SELF is missing"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
if (tb[IFLA_VF_PORTS]) {
|
||||
@ -546,14 +545,14 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("error while iterating over "
|
||||
"IFLA_VF_PORTS part"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (nla_parse_nested(tb_port, IFLA_PORT_MAX, tb_vf_ports,
|
||||
ifla_port_policy)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("error parsing IFLA_VF_PORT part"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This ensures that the given VF is present in the
|
||||
@ -601,7 +600,7 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf,
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("error parsing IFLA_VF_PORT "
|
||||
"during error reporting"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
if (tb_port[IFLA_PORT_INSTANCE_UUID]) {
|
||||
virUUIDFormat((unsigned char *)
|
||||
@ -613,31 +612,29 @@ virNetDevVPortProfileGetStatus(struct nlattr **tb, int32_t vf,
|
||||
*(uint32_t *)RTA_DATA(tb_port[IFLA_PORT_VF]) : -1,
|
||||
uuidstr);
|
||||
}
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("IFLA_VF_PORTS is missing"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (tb_port[IFLA_PORT_RESPONSE]) {
|
||||
*status = *(uint16_t *)RTA_DATA(tb_port[IFLA_PORT_RESPONSE]);
|
||||
rc = 0;
|
||||
} else {
|
||||
if (is8021Qbg) {
|
||||
/* no in-progress here; may be missing */
|
||||
*status = PORT_PROFILE_RESPONSE_INPROGRESS;
|
||||
rc = 0;
|
||||
} else {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("no IFLA_PORT_RESPONSE found in netlink message"));
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
cleanup:
|
||||
return rc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1051,7 +1048,6 @@ virNetDevVPortProfileOp8021Qbg(const char *ifname,
|
||||
enum virNetDevVPortProfileLinkOp virtPortOp,
|
||||
bool setlink_only)
|
||||
{
|
||||
int rc = -1;
|
||||
int op = PORT_REQUEST_ASSOCIATE;
|
||||
struct ifla_port_vsi portVsi = {
|
||||
.vsi_mgr_id = virtPort->managerID,
|
||||
@ -1069,7 +1065,7 @@ virNetDevVPortProfileOp8021Qbg(const char *ifname,
|
||||
|
||||
if (virNetDevVPortProfileGetPhysdevAndVlan(ifname, &physdev_ifindex,
|
||||
physdev_ifname, &vlanid) < 0) {
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (vlanid < 0)
|
||||
@ -1095,22 +1091,20 @@ virNetDevVPortProfileOp8021Qbg(const char *ifname,
|
||||
default:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("operation type %d not supported"), virtPortOp);
|
||||
goto cleanup;
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = virNetDevVPortProfileOpCommon(physdev_ifname, physdev_ifindex,
|
||||
nltarget_kernel,
|
||||
macaddr,
|
||||
vlanid,
|
||||
NULL,
|
||||
&portVsi,
|
||||
virtPort->instanceID,
|
||||
NULL,
|
||||
vf,
|
||||
op,
|
||||
setlink_only);
|
||||
cleanup:
|
||||
return rc;
|
||||
return virNetDevVPortProfileOpCommon(physdev_ifname, physdev_ifindex,
|
||||
nltarget_kernel,
|
||||
macaddr,
|
||||
vlanid,
|
||||
NULL,
|
||||
&portVsi,
|
||||
virtPort->instanceID,
|
||||
NULL,
|
||||
vf,
|
||||
op,
|
||||
setlink_only);
|
||||
}
|
||||
|
||||
/* Returns 0 on success, -1 on general failure, and -2 on timeout */
|
||||
|
@ -184,16 +184,14 @@ virNetlinkCreateSocket(int protocol)
|
||||
}
|
||||
nl_socket_enable_msg_peek(nlhandle);
|
||||
|
||||
cleanup:
|
||||
return nlhandle;
|
||||
|
||||
error:
|
||||
if (nlhandle) {
|
||||
nl_close(nlhandle);
|
||||
virNetlinkFree(nlhandle);
|
||||
nlhandle = NULL;
|
||||
}
|
||||
goto cleanup;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static virNetlinkHandle *
|
||||
|
@ -2146,32 +2146,28 @@ virPCIDeviceAddressParse(char *address,
|
||||
virPCIDeviceAddressPtr bdf)
|
||||
{
|
||||
char *p = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if ((address == NULL) || (logStrToLong_ui(address, &p, 16,
|
||||
&bdf->domain) == -1)) {
|
||||
goto out;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((p == NULL) || (logStrToLong_ui(p+1, &p, 16,
|
||||
&bdf->bus) == -1)) {
|
||||
goto out;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((p == NULL) || (logStrToLong_ui(p+1, &p, 16,
|
||||
&bdf->slot) == -1)) {
|
||||
goto out;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((p == NULL) || (logStrToLong_ui(p+1, &p, 16,
|
||||
&bdf->function) == -1)) {
|
||||
goto out;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
out:
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1102,27 +1102,24 @@ virSocketAddrPrefixToNetmask(unsigned int prefix,
|
||||
virSocketAddrPtr netmask,
|
||||
int family)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
netmask->data.stor.ss_family = AF_UNSPEC; /* assume failure */
|
||||
|
||||
if (family == AF_INET) {
|
||||
int ip;
|
||||
|
||||
if (prefix > 32)
|
||||
goto error;
|
||||
return -1;
|
||||
|
||||
ip = prefix ? ~((1 << (32 - prefix)) - 1) : 0;
|
||||
netmask->data.inet4.sin_addr.s_addr = htonl(ip);
|
||||
netmask->data.stor.ss_family = AF_INET;
|
||||
netmask->len = sizeof(struct sockaddr_in);
|
||||
result = 0;
|
||||
|
||||
} else if (family == AF_INET6) {
|
||||
size_t i = 0;
|
||||
|
||||
if (prefix > 128)
|
||||
goto error;
|
||||
return -1;
|
||||
|
||||
while (prefix >= 8) {
|
||||
/* do as much as possible an entire byte at a time */
|
||||
@ -1140,11 +1137,9 @@ virSocketAddrPrefixToNetmask(unsigned int prefix,
|
||||
}
|
||||
netmask->data.stor.ss_family = AF_INET6;
|
||||
netmask->len = sizeof(struct sockaddr_in6);
|
||||
result = 0;
|
||||
}
|
||||
|
||||
error:
|
||||
return result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -533,14 +533,12 @@ qcow2GetExtensions(const char *buf,
|
||||
}
|
||||
|
||||
case QCOW2_HDR_EXTENSION_END:
|
||||
goto done;
|
||||
return 0;
|
||||
}
|
||||
|
||||
offset += len;
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1478,7 +1478,7 @@ virSysinfoFormat(virBufferPtr buf, virSysinfoDefPtr def)
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \
|
||||
_("Target sysinfo %s %s does not match source %s"), \
|
||||
desc, NULLSTR(dst->name), NULLSTR(src->name)); \
|
||||
goto cleanup; \
|
||||
return false; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@ -1486,15 +1486,13 @@ static bool
|
||||
virSysinfoBIOSIsEqual(virSysinfoBIOSDefPtr src,
|
||||
virSysinfoBIOSDefPtr dst)
|
||||
{
|
||||
bool identical = false;
|
||||
|
||||
if (!src && !dst)
|
||||
return true;
|
||||
|
||||
if ((src && !dst) || (!src && dst)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Target sysinfo does not match source"));
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
|
||||
CHECK_FIELD(vendor, "BIOS vendor");
|
||||
@ -1502,24 +1500,20 @@ virSysinfoBIOSIsEqual(virSysinfoBIOSDefPtr src,
|
||||
CHECK_FIELD(date, "BIOS date");
|
||||
CHECK_FIELD(release, "BIOS release");
|
||||
|
||||
identical = true;
|
||||
cleanup:
|
||||
return identical;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
virSysinfoSystemIsEqual(virSysinfoSystemDefPtr src,
|
||||
virSysinfoSystemDefPtr dst)
|
||||
{
|
||||
bool identical = false;
|
||||
|
||||
if (!src && !dst)
|
||||
return true;
|
||||
|
||||
if ((src && !dst) || (!src && dst)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Target sysinfo does not match source"));
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
|
||||
CHECK_FIELD(manufacturer, "system vendor");
|
||||
@ -1530,24 +1524,20 @@ virSysinfoSystemIsEqual(virSysinfoSystemDefPtr src,
|
||||
CHECK_FIELD(sku, "system sku");
|
||||
CHECK_FIELD(family, "system family");
|
||||
|
||||
identical = true;
|
||||
cleanup:
|
||||
return identical;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
virSysinfoBaseBoardIsEqual(virSysinfoBaseBoardDefPtr src,
|
||||
virSysinfoBaseBoardDefPtr dst)
|
||||
{
|
||||
bool identical = false;
|
||||
|
||||
if (!src && !dst)
|
||||
return true;
|
||||
|
||||
if ((src && !dst) || (!src && dst)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Target base board does not match source"));
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
|
||||
CHECK_FIELD(manufacturer, "base board vendor");
|
||||
@ -1557,9 +1547,7 @@ virSysinfoBaseBoardIsEqual(virSysinfoBaseBoardDefPtr src,
|
||||
CHECK_FIELD(asset, "base board asset");
|
||||
CHECK_FIELD(location, "base board location");
|
||||
|
||||
identical = true;
|
||||
cleanup:
|
||||
return identical;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1567,15 +1555,13 @@ static bool
|
||||
virSysinfoChassisIsEqual(virSysinfoChassisDefPtr src,
|
||||
virSysinfoChassisDefPtr dst)
|
||||
{
|
||||
bool identical = false;
|
||||
|
||||
if (!src && !dst)
|
||||
return true;
|
||||
|
||||
if ((src && !dst) || (!src && dst)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Target chassis does not match source"));
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
|
||||
CHECK_FIELD(manufacturer, "chassis vendor");
|
||||
@ -1584,9 +1570,7 @@ virSysinfoChassisIsEqual(virSysinfoChassisDefPtr src,
|
||||
CHECK_FIELD(asset, "chassis asset");
|
||||
CHECK_FIELD(sku, "chassis sku");
|
||||
|
||||
identical = true;
|
||||
cleanup:
|
||||
return identical;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -1595,7 +1579,6 @@ virSysinfoChassisIsEqual(virSysinfoChassisDefPtr src,
|
||||
bool virSysinfoIsEqual(virSysinfoDefPtr src,
|
||||
virSysinfoDefPtr dst)
|
||||
{
|
||||
bool identical = false;
|
||||
size_t i;
|
||||
|
||||
if (!src && !dst)
|
||||
@ -1604,7 +1587,7 @@ bool virSysinfoIsEqual(virSysinfoDefPtr src,
|
||||
if ((src && !dst) || (!src && dst)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Target sysinfo does not match source"));
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (src->type != dst->type) {
|
||||
@ -1612,32 +1595,29 @@ bool virSysinfoIsEqual(virSysinfoDefPtr src,
|
||||
_("Target sysinfo %s does not match source %s"),
|
||||
virSysinfoTypeToString(dst->type),
|
||||
virSysinfoTypeToString(src->type));
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!virSysinfoBIOSIsEqual(src->bios, dst->bios))
|
||||
goto cleanup;
|
||||
return false;
|
||||
|
||||
if (!virSysinfoSystemIsEqual(src->system, dst->system))
|
||||
goto cleanup;
|
||||
return false;
|
||||
|
||||
if (src->nbaseBoard != dst->nbaseBoard) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("Target sysinfo base board count '%zu' does not match source '%zu'"),
|
||||
dst->nbaseBoard, src->nbaseBoard);
|
||||
goto cleanup;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; i < src->nbaseBoard; i++)
|
||||
if (!virSysinfoBaseBoardIsEqual(src->baseBoard + i,
|
||||
dst->baseBoard + i))
|
||||
goto cleanup;
|
||||
return false;
|
||||
|
||||
if (!virSysinfoChassisIsEqual(src->chassis, dst->chassis))
|
||||
goto cleanup;
|
||||
return false;
|
||||
|
||||
identical = true;
|
||||
|
||||
cleanup:
|
||||
return identical;
|
||||
return true;
|
||||
}
|
||||
|
@ -216,16 +216,15 @@ virTPMExecGetCaps(virCommandPtr cmd,
|
||||
continue;
|
||||
|
||||
if (virBitmapSetBitExpand(bitmap, typ) < 0)
|
||||
goto cleanup;
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
return bitmap;
|
||||
|
||||
error_bad_json:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unexpected JSON format: %s"), outbuf);
|
||||
goto cleanup;
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
static virBitmapPtr
|
||||
|
@ -327,12 +327,12 @@ virTypedParamsReplaceString(virTypedParameterPtr *params,
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("Parameter '%s' is not a string"),
|
||||
param->field);
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
old = param->value.s;
|
||||
} else {
|
||||
if (VIR_EXPAND_N(*params, n, 1) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
param = *params + n - 1;
|
||||
}
|
||||
|
||||
@ -342,15 +342,12 @@ virTypedParamsReplaceString(virTypedParameterPtr *params,
|
||||
VIR_TYPED_PARAM_STRING, str) < 0) {
|
||||
param->value.s = old;
|
||||
VIR_FREE(str);
|
||||
goto error;
|
||||
return -1;
|
||||
}
|
||||
VIR_FREE(old);
|
||||
|
||||
*nparams = n;
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -404,7 +401,7 @@ virTypedParamsFilter(virTypedParameterPtr params,
|
||||
size_t i, n = 0;
|
||||
|
||||
if (VIR_ALLOC_N(*ret, nparams) < 0)
|
||||
goto error;
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < nparams; i++) {
|
||||
if (STREQ(params[i].field, name)) {
|
||||
@ -414,9 +411,6 @@ virTypedParamsFilter(virTypedParameterPtr params,
|
||||
}
|
||||
|
||||
return n;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,20 +107,20 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid)
|
||||
for (i = 0; i < VIR_UUID_BUFLEN;) {
|
||||
uuid[i] = 0;
|
||||
if (*cur == 0)
|
||||
goto error;
|
||||
return -1;
|
||||
if ((*cur == '-') || (*cur == ' ')) {
|
||||
cur++;
|
||||
continue;
|
||||
}
|
||||
if (!g_ascii_isxdigit(*cur))
|
||||
goto error;
|
||||
return -1;
|
||||
uuid[i] = virHexToBin(*cur);
|
||||
uuid[i] *= 16;
|
||||
cur++;
|
||||
if (*cur == 0)
|
||||
goto error;
|
||||
return -1;
|
||||
if (!g_ascii_isxdigit(*cur))
|
||||
goto error;
|
||||
return -1;
|
||||
uuid[i] += virHexToBin(*cur);
|
||||
i++;
|
||||
cur++;
|
||||
@ -128,14 +128,11 @@ virUUIDParse(const char *uuidstr, unsigned char *uuid)
|
||||
|
||||
while (*cur) {
|
||||
if (!g_ascii_isspace(*cur))
|
||||
goto error;
|
||||
return -1;
|
||||
cur++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user