aboutsummaryrefslogtreecommitdiffstats
path: root/src/directory.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-04-04 19:08:05 +0200
committerMax Kellermann <max@duempel.org>2012-04-04 19:08:05 +0200
commitd8e423df1a3c4ea7db547089c8cf0647268cfd44 (patch)
tree70e12a9d3011a83bd4eec5e458eff6013837c30c /src/directory.c
parent09aa0dc676ead2a76c720a033271c8c7dbef1548 (diff)
downloadmpd-d8e423df1a3c4ea7db547089c8cf0647268cfd44.tar.gz
mpd-d8e423df1a3c4ea7db547089c8cf0647268cfd44.tar.xz
mpd-d8e423df1a3c4ea7db547089c8cf0647268cfd44.zip
directory: use strrchr() instead of g_basename()
g_basename() is deprecated in GLib 2.32.
Diffstat (limited to 'src/directory.c')
-rw-r--r--src/directory.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/directory.c b/src/directory.c
index fa15d41b1..1e3a4cf28 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -68,7 +68,15 @@ directory_free(struct directory *directory)
const char *
directory_get_name(const struct directory *directory)
{
- return g_basename(directory->path);
+ assert(!directory_is_root(directory));
+ assert(directory->path != NULL);
+
+ const char *slash = strrchr(directory->path, '/');
+ assert((slash == NULL) == directory_is_root(directory->parent));
+
+ return slash != NULL
+ ? slash + 1
+ : directory->path;
}
void