diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-07-20 11:38:15 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-07-31 18:20:28 +0200 |
commit | 7bf7ce28b5a1f589f0f2382e54c03ab9b0794fab (patch) | |
tree | 701387d210e1e75c063a734ea6fe13bf33d88f87 /src/basic/escape.c | |
parent | 6f8cbcdb27d772521ba71f92c25fd522efd56cf4 (diff) | |
download | systemd-7bf7ce28b5a1f589f0f2382e54c03ab9b0794fab.tar.gz |
string-util: add strlen_ptr() helper
strlen_ptr() is to strlen() what streq_ptr() is to streq(): i.e. it
handles NULL strings in a smart way.
Diffstat (limited to 'src/basic/escape.c')
-rw-r--r-- | src/basic/escape.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/basic/escape.c b/src/basic/escape.c index 85e4b5282e..22b8b04156 100644 --- a/src/basic/escape.c +++ b/src/basic/escape.c @@ -314,7 +314,7 @@ int cunescape_length_with_prefix(const char *s, size_t length, const char *prefi /* Undoes C style string escaping, and optionally prefixes it. */ - pl = prefix ? strlen(prefix) : 0; + pl = strlen_ptr(prefix); r = new(char, pl+length+1); if (!r) |