summaryrefslogtreecommitdiff
path: root/src/basic/string-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-06-06 11:58:38 +0200
committerSven Eden <yamakuzure@gmx.net>2018-08-24 16:47:08 +0200
commit9f900051e499dbedb1aae2a0f81c4a295d2069ae (patch)
tree755b5ebca503a005f3f7a4b532f52b26ee379921 /src/basic/string-util.c
parentc8ed5d3ab1b79c088b26a26715556d61b213e2a7 (diff)
string-util: put together strstrip() from skip_leading_chars() and delete_trailing_chars()
Diffstat (limited to 'src/basic/string-util.c')
-rw-r--r--src/basic/string-util.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/basic/string-util.c b/src/basic/string-util.c
index b53686a11..13456f101 100644
--- a/src/basic/string-util.c
+++ b/src/basic/string-util.c
@@ -269,23 +269,12 @@ char *strjoin_real(const char *x, ...) {
}
char *strstrip(char *s) {
- char *e;
-
if (!s)
return NULL;
- /* Drops trailing whitespace. Modifies the string in
- * place. Returns pointer to first non-space character */
+ /* Drops trailing whitespace. Modifies the string in place. Returns pointer to first non-space character */
- s += strspn(s, WHITESPACE);
-
- for (e = strchr(s, 0); e > s; e --)
- if (!strchr(WHITESPACE, e[-1]))
- break;
-
- *e = 0;
-
- return s;
+ return delete_trailing_chars(skip_leading_chars(s, WHITESPACE), WHITESPACE);
}
#if 0 /// UNNEEDED by elogind