aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-16 16:09:10 +0100
committerMax Kellermann <max@duempel.org>2009-12-16 15:53:57 +0100
commitc3e0fbd9e4d05a751fb8b32a3524cfa9c95c1994 (patch)
treefb79ec0f4a074c132fc6dee2cfccc44775e0b410 /src
parentb05ba0286e2541197d58b7b7be945f495c3ffeab (diff)
downloadmpd-c3e0fbd9e4d05a751fb8b32a3524cfa9c95c1994.tar.gz
mpd-c3e0fbd9e4d05a751fb8b32a3524cfa9c95c1994.tar.xz
mpd-c3e0fbd9e4d05a751fb8b32a3524cfa9c95c1994.zip
archive/bz2: use g_path_get_basename()
Use g_path_get_basename() instead of manually filtering the path name. Big advantage: g_path_get_basename() cannot fail.
Diffstat (limited to 'src')
-rw-r--r--src/archive/bz2_plugin.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/archive/bz2_plugin.c b/src/archive/bz2_plugin.c
index 4e5733225..713dcc234 100644
--- a/src/archive/bz2_plugin.c
+++ b/src/archive/bz2_plugin.c
@@ -98,7 +98,6 @@ static struct archive_file *
bz2_open(char *pathname)
{
bz2_context *context;
- char *name;
int len;
context = g_malloc(sizeof(*context));
@@ -110,15 +109,7 @@ bz2_open(char *pathname)
return NULL;
}
- //capture filename
- name = strrchr(pathname, '/');
- if (name == NULL) {
- g_warning("failed to get bzip2 name from %s\n",pathname);
- g_free(context);
- return NULL;
- }
-
- context->name = g_strdup(name + 1);
+ context->name = g_path_get_basename(pathname);
//remove suffix
len = strlen(context->name);