From: Martin Wilck <mwi...@suse.com>

strchop() returns size_t, so have it work with size_t, too. Also,
avoid the unnecessary second call to strlen().

Signed-off-by: Martin Wilck <mwi...@suse.com>
---
 libmultipath/util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libmultipath/util.c b/libmultipath/util.c
index 51c38c8..28d0168 100644
--- a/libmultipath/util.c
+++ b/libmultipath/util.c
@@ -26,11 +26,11 @@
 size_t
 strchop(char *str)
 {
-       int i;
+       size_t i;
 
-       for (i=strlen(str)-1; i >=0 && isspace(str[i]); --i) ;
+       for (i = strlen(str) - 1; i != (size_t) -1 && isspace(str[i]); i--) ;
        str[++i] = '\0';
-       return strlen(str);
+       return i;
 }
 
 int
-- 
2.26.2


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel

Reply via email to