mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-27 11:01:19 +00:00
nwfilter: Clean up virNWFilterDetermineMissingVarsRec returns
Rather than using loop break;'s in order to force a return of rc = -1, let's just return -1 immediately on the various error paths and then return 0 on the success path.
This commit is contained in:
parent
3e581d150a
commit
ca3bef4cec
@ -515,15 +515,13 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
|
|||||||
virNWFilterVarAccessPrint(rule->varAccess[j], &buf);
|
virNWFilterVarAccessPrint(rule->varAccess[j], &buf);
|
||||||
if (virBufferError(&buf)) {
|
if (virBufferError(&buf)) {
|
||||||
virReportOOMError();
|
virReportOOMError();
|
||||||
rc = -1;
|
return -1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val = virNWFilterVarValueCreateSimpleCopyValue("1");
|
val = virNWFilterVarValueCreateSimpleCopyValue("1");
|
||||||
if (!val) {
|
if (!val) {
|
||||||
virBufferFreeAndReset(&buf);
|
virBufferFreeAndReset(&buf);
|
||||||
rc = -1;
|
return -1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
varAccess = virBufferContentAndReset(&buf);
|
varAccess = virBufferContentAndReset(&buf);
|
||||||
@ -532,21 +530,16 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
|
|||||||
VIR_FREE(varAccess);
|
VIR_FREE(varAccess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (rc)
|
|
||||||
break;
|
|
||||||
} else if (inc) {
|
} else if (inc) {
|
||||||
VIR_DEBUG("Following filter %s", inc->filterref);
|
VIR_DEBUG("Following filter %s", inc->filterref);
|
||||||
if (!(obj = virNWFilterObjListFindInstantiateFilter(driver->nwfilters,
|
if (!(obj = virNWFilterObjListFindInstantiateFilter(driver->nwfilters,
|
||||||
inc->filterref))) {
|
inc->filterref)))
|
||||||
rc = -1;
|
return -1;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create a temporary hashmap for depth-first tree traversal */
|
/* create a temporary hashmap for depth-first tree traversal */
|
||||||
if (!(tmpvars = virNWFilterCreateVarsFrom(inc->params, vars))) {
|
if (!(tmpvars = virNWFilterCreateVarsFrom(inc->params, vars))) {
|
||||||
rc = -1;
|
|
||||||
virNWFilterObjUnlock(obj);
|
virNWFilterObjUnlock(obj);
|
||||||
break;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
next_filter = virNWFilterObjGetDef(obj);
|
next_filter = virNWFilterObjGetDef(obj);
|
||||||
@ -571,10 +564,10 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
|
|||||||
|
|
||||||
virNWFilterObjUnlock(obj);
|
virNWFilterObjUnlock(obj);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
break;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return rc;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user