mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
libdm: dm_report_object avoid duplicat strlen call
Remember strlen result.
This commit is contained in:
parent
922f884abe
commit
3d9737442b
@ -703,6 +703,7 @@ int dm_report_object(struct dm_report *rh, void *object)
|
|||||||
struct row *row;
|
struct row *row;
|
||||||
struct dm_report_field *field;
|
struct dm_report_field *field;
|
||||||
void *data = NULL;
|
void *data = NULL;
|
||||||
|
int len;
|
||||||
|
|
||||||
if (!rh) {
|
if (!rh) {
|
||||||
log_error(INTERNAL_ERROR "dm_report handler is NULL.");
|
log_error(INTERNAL_ERROR "dm_report handler is NULL.");
|
||||||
@ -750,8 +751,9 @@ int dm_report_object(struct dm_report *rh, void *object)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((int) strlen(field->report_string) > field->props->width))
|
len = (int) strlen(field->report_string);
|
||||||
field->props->width = (int) strlen(field->report_string);
|
if (len > field->props->width)
|
||||||
|
field->props->width = len;
|
||||||
|
|
||||||
if ((rh->flags & RH_SORT_REQUIRED) &&
|
if ((rh->flags & RH_SORT_REQUIRED) &&
|
||||||
(field->props->flags & FLD_SORT_KEY)) {
|
(field->props->flags & FLD_SORT_KEY)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user