mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-30 17:18:21 +03:00
const: use common error path
Instead of defining _field_selection_value_alloc_failed_msg[], use common error path code for printing field_id.
This commit is contained in:
parent
8bbd00162b
commit
e0bd66b73a
@ -3516,7 +3516,6 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
|
||||
struct reserved_value_wrapper *rvw,
|
||||
void *custom)
|
||||
{
|
||||
static const char *_field_selection_value_alloc_failed_msg = "dm_report: struct field_selection_value allocation failed for selection field %s";
|
||||
const struct dm_report_field_type *fields = implicit ? _implicit_report_fields
|
||||
: rh->fields;
|
||||
struct field_properties *fp, *found = NULL;
|
||||
@ -3564,8 +3563,8 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
|
||||
}
|
||||
|
||||
if (!(fs->value = dm_pool_zalloc(rh->selection->mem, sizeof(struct field_selection_value)))) {
|
||||
log_error(_field_selection_value_alloc_failed_msg, field_id);
|
||||
goto error;
|
||||
stack;
|
||||
goto error_field_id;
|
||||
}
|
||||
|
||||
if (((rvw->reserved && (rvw->reserved->type & DM_REPORT_FIELD_RESERVED_VALUE_RANGE)) ||
|
||||
@ -3573,8 +3572,8 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
|
||||
custom && ((struct time_value *) custom)->range))
|
||||
&&
|
||||
!(fs->value->next = dm_pool_zalloc(rh->selection->mem, sizeof(struct field_selection_value)))) {
|
||||
log_error(_field_selection_value_alloc_failed_msg, field_id);
|
||||
goto error;
|
||||
stack;
|
||||
goto error_field_id;
|
||||
}
|
||||
|
||||
fs->fp = found;
|
||||
@ -3723,6 +3722,10 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
|
||||
}
|
||||
|
||||
return fs;
|
||||
error_field_id:
|
||||
log_error("dm_report: struct field_selection_value allocation failed for selection field %s",
|
||||
field_id);
|
||||
goto error;
|
||||
bad:
|
||||
log_error(INTERNAL_ERROR "Forbiden NULL custom detected.");
|
||||
error:
|
||||
|
@ -3514,7 +3514,6 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
|
||||
struct reserved_value_wrapper *rvw,
|
||||
void *custom)
|
||||
{
|
||||
static const char *_field_selection_value_alloc_failed_msg = "dm_report: struct field_selection_value allocation failed for selection field %s";
|
||||
const struct dm_report_field_type *fields = implicit ? _implicit_report_fields
|
||||
: rh->fields;
|
||||
struct field_properties *fp, *found = NULL;
|
||||
@ -3562,8 +3561,8 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
|
||||
}
|
||||
|
||||
if (!(fs->value = dm_pool_zalloc(rh->selection->mem, sizeof(struct field_selection_value)))) {
|
||||
log_error(_field_selection_value_alloc_failed_msg, field_id);
|
||||
goto error;
|
||||
stack;
|
||||
goto error_field_id;
|
||||
}
|
||||
|
||||
if (((rvw->reserved && (rvw->reserved->type & DM_REPORT_FIELD_RESERVED_VALUE_RANGE)) ||
|
||||
@ -3571,8 +3570,8 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
|
||||
custom && ((struct time_value *) custom)->range))
|
||||
&&
|
||||
!(fs->value->next = dm_pool_zalloc(rh->selection->mem, sizeof(struct field_selection_value)))) {
|
||||
log_error(_field_selection_value_alloc_failed_msg, field_id);
|
||||
goto error;
|
||||
stack;
|
||||
goto error_field_id;
|
||||
}
|
||||
|
||||
fs->fp = found;
|
||||
@ -3721,6 +3720,10 @@ static struct field_selection *_create_field_selection(struct dm_report *rh,
|
||||
}
|
||||
|
||||
return fs;
|
||||
error_field_id:
|
||||
log_error("dm_report: struct field_selection_value allocation failed for selection field %s",
|
||||
field_id);
|
||||
goto error;
|
||||
bad:
|
||||
log_error(INTERNAL_ERROR "Forbiden NULL custom detected.");
|
||||
error:
|
||||
|
Loading…
Reference in New Issue
Block a user