提交 ce9085eb 编写于 作者: J Ján Tomko

leaseshelper: reduce indentation level in virLeaseReadCustomLeaseFile

Instead of nested ifs, jump out early.

Mostly whitespace changes.
上级 d7049a67
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册