aboutsummaryrefslogtreecommitdiffstats
path: root/src/path.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-29 09:38:58 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-02 00:20:14 -0700
commit07c4a01f9fa55b620c9bf87a4e64e45de22b7e5f (patch)
tree64daf1c94aeabd86cc9f4155a6fae3c8ea3a5943 /src/path.c
parente3805dafb34a6fb3ae0421bd0414ee7fd27e2106 (diff)
downloadmpd-07c4a01f9fa55b620c9bf87a4e64e45de22b7e5f.tar.gz
mpd-07c4a01f9fa55b620c9bf87a4e64e45de22b7e5f.tar.xz
mpd-07c4a01f9fa55b620c9bf87a4e64e45de22b7e5f.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/path.c')
-rw-r--r--src/path.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/path.c b/src/path.c
index 6aaff84cf..ceb00c5de 100644
--- a/src/path.c
+++ b/src/path.c
@@ -47,7 +47,7 @@ static char *path_conv_charset(char *dest, const char *to,
char *fs_charset_to_utf8(char *dst, const char *str)
{
char *ret = path_conv_charset(dst, "UTF-8", fsCharset, str);
- return (ret && !validUtf8String(ret)) ? NULL : ret;
+ return (ret && !validUtf8String(ret, strlen(ret))) ? NULL : ret;
}
char *utf8_to_fs_charset(char *dst, const char *str)