1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

libdm: dm_report_object avoid duplicat strlen call

Remember strlen result.
This commit is contained in:
Zdenek Kabelac 2014-06-12 11:36:51 +02:00
parent 922f884abe
commit 3d9737442b

View File

@ -703,6 +703,7 @@ int dm_report_object(struct dm_report *rh, void *object)
struct row *row;
struct dm_report_field *field;
void *data = NULL;
int len;
if (!rh) {
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;
}
if (((int) strlen(field->report_string) > field->props->width))
field->props->width = (int) strlen(field->report_string);
len = (int) strlen(field->report_string);
if (len > field->props->width)
field->props->width = len;
if ((rh->flags & RH_SORT_REQUIRED) &&
(field->props->flags & FLD_SORT_KEY)) {