mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
virStorageBackendLogicalParseVolExtents: Remove 'cleanup' and 'ret'
The function was inconsistently using 'return -1' and 'goto cleanup;' unify it by removing the cleanup label and 'ret' variable. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
e03e54c9a2
commit
51733511d1
@ -122,7 +122,6 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDef *vol,
|
|||||||
g_autoptr(GError) err = NULL;
|
g_autoptr(GError) err = NULL;
|
||||||
g_autoptr(GMatchInfo) info = NULL;
|
g_autoptr(GMatchInfo) info = NULL;
|
||||||
int nextents;
|
int nextents;
|
||||||
int ret = -1;
|
|
||||||
const char *regex_unit = "(\\S+)\\((\\S+)\\)";
|
const char *regex_unit = "(\\S+)\\((\\S+)\\)";
|
||||||
size_t i;
|
size_t i;
|
||||||
unsigned long long offset;
|
unsigned long long offset;
|
||||||
@ -144,20 +143,20 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDef *vol,
|
|||||||
if (virStrToLong_i(groups[5], NULL, 10, &nextents) < 0) {
|
if (virStrToLong_i(groups[5], NULL, 10, &nextents) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("malformed volume extent stripes value"));
|
_("malformed volume extent stripes value"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virStrToLong_ull(groups[6], NULL, 10, &length) < 0) {
|
if (virStrToLong_ull(groups[6], NULL, 10, &length) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("malformed volume extent length value"));
|
"%s", _("malformed volume extent length value"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virStrToLong_ull(groups[7], NULL, 10, &size) < 0) {
|
if (virStrToLong_ull(groups[7], NULL, 10, &size) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
"%s", _("malformed volume extent size value"));
|
"%s", _("malformed volume extent size value"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate space for 'nextents' regex_unit strings plus a comma for each */
|
/* Allocate space for 'nextents' regex_unit strings plus a comma for each */
|
||||||
@ -179,7 +178,7 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDef *vol,
|
|||||||
if (!g_regex_match(re, groups[3], 0, &info)) {
|
if (!g_regex_match(re, groups[3], 0, &info)) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("malformed volume extent devices value"));
|
_("malformed volume extent devices value"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Each extent has a "path:offset" pair, and match #0
|
/* Each extent has a "path:offset" pair, and match #0
|
||||||
@ -197,7 +196,7 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDef *vol,
|
|||||||
if (virStrToLong_ull(offset_str, NULL, 10, &offset) < 0) {
|
if (virStrToLong_ull(offset_str, NULL, 10, &offset) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("malformed volume extent offset value"));
|
_("malformed volume extent offset value"));
|
||||||
goto cleanup;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
extent.path = g_match_info_fetch(info, j);
|
extent.path = g_match_info_fetch(info, j);
|
||||||
@ -207,10 +206,7 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDef *vol,
|
|||||||
VIR_APPEND_ELEMENT(vol->source.extents, vol->source.nextent, extent);
|
VIR_APPEND_ELEMENT(vol->source.extents, vol->source.nextent, extent);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = 0;
|
return 0;
|
||||||
|
|
||||||
cleanup:
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user