master - libdm: dm_report_object avoid duplicat strlen call
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3d9737442b97665aea1d03483f218806727a254d Commit: 3d9737442b97665aea1d03483f218806727a254d Parent: 922f884abeae010589fa775b022d284dfec9e075 Author: Zdenek Kabelac <[email protected]> AuthorDate: Thu Jun 12 11:36:51 2014 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Thu Jun 12 11:56:06 2014 +0200
libdm: dm_report_object avoid duplicat strlen call
Remember strlen result.
--- libdm/libdm-report.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
libdm/libdm-report.c +4 -2
@@ -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 )) {