diff options
author | Max Kellermann <max@duempel.org> | 2015-09-01 21:16:08 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2015-09-01 21:16:22 +0200 |
commit | 6f41791ea677edfa9614ef8624c465d16abf0ec5 (patch) | |
tree | 192b33ac542d513c47181b259f71e883d917ada2 /src/util | |
parent | 0bacbcd04e1dfd74c4271c17cc1401c3493d19f4 (diff) | |
download | mpd-6f41791ea677edfa9614ef8624c465d16abf0ec5.tar.gz mpd-6f41791ea677edfa9614ef8624c465d16abf0ec5.tar.xz mpd-6f41791ea677edfa9614ef8624c465d16abf0ec5.zip |
util/StringAPI: add UnsafeCopyStringP()
Diffstat (limited to '')
-rw-r--r-- | src/util/StringAPI.hxx | 13 | ||||
-rw-r--r-- | src/util/WStringAPI.hxx | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/src/util/StringAPI.hxx b/src/util/StringAPI.hxx index 334e9dee7..08087f5f8 100644 --- a/src/util/StringAPI.hxx +++ b/src/util/StringAPI.hxx @@ -101,6 +101,19 @@ UnsafeCopyString(char *dest, const char *src) strcpy(dest, src); } +gcc_nonnull_all +static inline char * +UnsafeCopyStringP(char *dest, const char *src) +{ +#if defined(WIN32) || defined(__BIONIC__) + /* emulate stpcpy() */ + UnsafeCopyString(dest, src); + return dest + StringLength(dest); +#else + return stpcpy(dest, src); +#endif +} + /** * Checks whether #a and #b are equal. */ diff --git a/src/util/WStringAPI.hxx b/src/util/WStringAPI.hxx index 59ee980f4..e020ecd7f 100644 --- a/src/util/WStringAPI.hxx +++ b/src/util/WStringAPI.hxx @@ -97,6 +97,19 @@ UnsafeCopyString(wchar_t *dest, const wchar_t *src) wcscpy(dest, src); } +gcc_nonnull_all +static inline wchar_t * +UnsafeCopyStringP(wchar_t *dest, const wchar_t *src) +{ +#if defined(WIN32) || defined(__BIONIC__) + /* emulate wcpcpy() */ + UnsafeCopyString(dest, src); + return dest + StringLength(dest); +#else + return wcpcpy(dest, src); +#endif +} + /** * Checks whether str1 and str2 are equal. * @param str1 String 1 |