From d8e423df1a3c4ea7db547089c8cf0647268cfd44 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Apr 2012 19:08:05 +0200 Subject: directory: use strrchr() instead of g_basename() g_basename() is deprecated in GLib 2.32. --- src/directory.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/directory.c') 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 -- cgit v1.2.3