From e681595f8196c84fa46ca63cd9d67924d6e62325 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 3 Jun 2020 11:55:04 +0200 Subject: chomp: Don't measure length of string every iteration --- libcrystfel/src/utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libcrystfel/src/utils.c b/libcrystfel/src/utils.c index 1e225778..411274a1 100644 --- a/libcrystfel/src/utils.c +++ b/libcrystfel/src/utils.c @@ -327,10 +327,12 @@ size_t notrail(char *s) void chomp(char *s) { size_t i; + size_t len; if ( s == NULL ) return; + len = strlen(s); - for ( i=0; i