diff options
author | Max Kellermann <max@duempel.org> | 2008-10-03 11:51:32 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-03 11:51:32 +0200 |
commit | 44ecb3b869a8106475b984b4a0d212f9b3b3a219 (patch) | |
tree | 5c9cd8001f54341a22ddeecfc2781fa979ce63f2 /src/screen_file.c | |
parent | ccc7cf81e560025520777118a00a4c041bd7a149 (diff) | |
download | mpd-44ecb3b869a8106475b984b4a0d212f9b3b3a219.tar.gz mpd-44ecb3b869a8106475b984b4a0d212f9b3b3a219.tar.xz mpd-44ecb3b869a8106475b984b4a0d212f9b3b3a219.zip |
use g_basename() instead of basename()
g_basename() is always available, no need to implement a fallback.
Also use g_path_get_dirname(), g_path_get_basename().
Diffstat (limited to 'src/screen_file.c')
-rw-r--r-- | src/screen_file.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/screen_file.c b/src/screen_file.c index baec535df..95510a516 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -20,7 +20,6 @@ #include "i18n.h" #include "options.h" #include "charset.h" -#include "support.h" #include "mpdclient.h" #include "command.h" #include "screen.h" @@ -121,7 +120,7 @@ handle_delete(screen_t *screen, mpdclient_t *c) } plf = entity->info.playlistFile; - str = utf8_to_locale(basename(plf->path)); + str = utf8_to_locale(g_basename(plf->path)); buf = g_strdup_printf(_("Delete playlist %s [%s/%s] ? "), str, YES, NO); g_free(str); key = tolower(screen_getch(screen->status_window.w, buf)); @@ -176,12 +175,10 @@ browse_open(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) static const char * browse_title(char *str, size_t size) { - char *pathcopy; - char *parentdir; + char *dirname, *parentdir; - pathcopy = strdup(browser.filelist->path); - parentdir = dirname(pathcopy); - parentdir = basename(parentdir); + dirname = g_path_get_dirname(browser.filelist->path); + parentdir = g_path_get_basename(dirname); if( parentdir[0] == '.' && strlen(parentdir) == 1 ) { parentdir = NULL; @@ -190,8 +187,9 @@ browse_title(char *str, size_t size) g_snprintf(str, size, _("Browse: %s%s%s"), parentdir ? parentdir : "", parentdir ? "/" : "", - basename(browser.filelist->path)); - free(pathcopy); + g_basename(browser.filelist->path)); + free(dirname); + free(parentdir); return str; } |