mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
leaseshelper: reduce indentation level in virLeaseReadCustomLeaseFile
Instead of nested ifs, jump out early. Mostly whitespace changes.
This commit is contained in:
parent
d7049a67b6
commit
ce9085eba1
@ -132,12 +132,19 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new,
|
||||
}
|
||||
|
||||
/* Check for previous leases */
|
||||
if (custom_lease_file_len) {
|
||||
if (custom_lease_file_len == 0) {
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!(leases_array = virJSONValueFromString(lease_entries))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("invalid json in file: %s, rewriting it"),
|
||||
custom_lease_file);
|
||||
} else {
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virJSONValueIsArray(leases_array)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("couldn't fetch array of leases"));
|
||||
@ -146,7 +153,6 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new,
|
||||
|
||||
i = 0;
|
||||
while (i < virJSONValueArraySize(leases_array)) {
|
||||
|
||||
if (!(lease_tmp = virJSONValueArrayGet(leases_array, i))) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("failed to parse json"));
|
||||
@ -199,8 +205,6 @@ virLeaseReadCustomLeaseFile(virJSONValuePtr leases_array_new,
|
||||
|
||||
ignore_value(virJSONValueArraySteal(leases_array, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user