diff options
author | Max Kellermann <max@duempel.org> | 2008-08-29 09:38:58 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-29 09:38:58 +0200 |
commit | 43c389b961c609f9c705cfe14ed429082ac9115a (patch) | |
tree | 61e93ef93115a5f96c5981cae1fd7a36e789d9f7 /src/utf8.h | |
parent | 92b757674ebcf5cf90e8adb66e7583edf1bc604e (diff) | |
download | mpd-43c389b961c609f9c705cfe14ed429082ac9115a.tar.gz mpd-43c389b961c609f9c705cfe14ed429082ac9115a.tar.xz mpd-43c389b961c609f9c705cfe14ed429082ac9115a.zip |
added "length" parameter to validUtf8String()
At several places, we create temporary copies of non-null-terminated
strings, just to use them in functions like validUtf8String(). We can
save this temporary allocation and avoid heap fragmentation if we
add a length parameter instead of expecting a null-terminated string.
Diffstat (limited to 'src/utf8.h')
-rw-r--r-- | src/utf8.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/utf8.h b/src/utf8.h index 4a4983064..353977bef 100644 --- a/src/utf8.h +++ b/src/utf8.h @@ -19,11 +19,13 @@ #ifndef UTF_8_H #define UTF_8_H +#include <os_compat.h> + char *latin1StrToUtf8Dup(const char *latin1); char *utf8StrToLatin1Dup(const char *utf8); -int validUtf8String(const char *string); +int validUtf8String(const char *string, size_t length); char *utf8_to_latin1(char *dest, const char *utf8); |