path: replaced mpd_basename() with g_path_get_basename()

GLib's g_path_get_basename() is much more reliable than
mpd_basename().  The latter could be tricked into an assertion
failure.
This commit is contained in:
Max Kellermann
2008-10-20 22:18:12 +02:00
parent 99e82a2ef2
commit ba96920a52
6 changed files with 30 additions and 29 deletions

View File

@@ -276,15 +276,3 @@ void utf8_to_fs_playlist_path(char *path_max_tmp, const char *utf8path)
rpp2app_r(path_max_tmp, path_max_tmp);
strncat(path_max_tmp, "." PLAYLIST_FILE_SUFFIX, MPD_PATH_MAX - 1);
}
/* Only takes sanitized paths w/o trailing slashes */
const char *mpd_basename(const char *path)
{
const char *ret = strrchr(path, '/');
if (!ret)
return path;
++ret;
assert(*ret != '\0');
return ret;
}