aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcrystfel/src/utils.c4
1 files changed, 3 insertions, 1 deletions
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<strlen(s); i++ ) {
+ for ( i=0; i<len; i++ ) {
if ( (s[i] == '\n') || (s[i] == '\r') ) {
s[i] = '\0';
return;