comparison common/strhelp.c @ 135:3fb6ddd6b70d

str_trim: do nothing if *s is NULL.
author Sascha Wilde <wilde@intevation.de>
date Mon, 24 Mar 2014 15:34:28 +0100
parents 5f830969e4a1
children 5fa4791d6d0e
comparison
equal deleted inserted replaced
134:5f830969e4a1 135:3fb6ddd6b70d
127 127
128 void 128 void
129 str_trim (char **s) 129 str_trim (char **s)
130 { 130 {
131 size_t i; 131 size_t i;
132 while (isspace(**s)) 132 if (*s != NULL)
133 (*s)++; 133 {
134 i = strlen(*s); 134 while (isspace(**s))
135 while (isspace((*s)[--i])) 135 (*s)++;
136 (*s)[i] = '\0'; 136 i = strlen(*s);
137 while (isspace((*s)[--i]))
138 (*s)[i] = '\0';
139 }
137 } 140 }

http://wald.intevation.org/projects/trustbridge/