path: removed pfx_dir()

Use GLib's g_build_filename() instead of pfx_dir().
This commit is contained in:
Max Kellermann
2009-01-04 19:37:19 +01:00
parent 1a04e57168
commit da69382273
4 changed files with 10 additions and 41 deletions

View File

@@ -107,20 +107,3 @@ void path_global_finish(void)
{
g_free(fs_charset);
}
char *pfx_dir(char *dst,
const char *path, const size_t path_len,
const char *pfx, const size_t pfx_len)
{
if (G_UNLIKELY((pfx_len + path_len + 1) >= MPD_PATH_MAX))
g_error("Cannot prefix '%s' to '%s', PATH_MAX: %d",
pfx, path, MPD_PATH_MAX);
/* memmove allows dst == path */
memmove(dst + pfx_len + 1, path, path_len + 1);
memcpy(dst, pfx, pfx_len);
dst[pfx_len] = '/';
/* this is weird, but directory.c can use it more safely/efficiently */
return (dst + pfx_len + 1);
}