aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2012-01-24 18:26:49 +0100
committerMax Kellermann <max@duempel.org>2012-01-24 18:27:00 +0100
commita0fcd0cf22d1eb70afad394d0676635e033ac703 (patch)
tree70f681968bb52f1ca4a0e5258092fe59ddc0f22e
parent5d5c753c746646b0fa86fd2395fb4f76fd96aaae (diff)
downloadmpd-a0fcd0cf22d1eb70afad394d0676635e033ac703.tar.gz
mpd-a0fcd0cf22d1eb70afad394d0676635e033ac703.tar.xz
mpd-a0fcd0cf22d1eb70afad394d0676635e033ac703.zip
dirvec: don't call g_path_get_basename() on parameter
This overhead is completely useless, because no caller expects this behaviour.
Diffstat (limited to '')
-rw-r--r--src/dirvec.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/dirvec.c b/src/dirvec.c
index 520a48513..55021c16e 100644
--- a/src/dirvec.c
+++ b/src/dirvec.c
@@ -50,22 +50,15 @@ void dirvec_sort(struct dirvec *dv)
struct directory *dirvec_find(const struct dirvec *dv, const char *path)
{
- char *base;
int i;
- struct directory *ret = NULL;
-
- base = g_path_get_basename(path);
db_lock();
for (i = dv->nr; --i >= 0; )
- if (!strcmp(directory_get_name(dv->base[i]), base)) {
- ret = dv->base[i];
- break;
- }
+ if (!strcmp(directory_get_name(dv->base[i]), path))
+ return dv->base[i];
db_unlock();
- g_free(base);
- return ret;
+ return NULL;
}
int dirvec_delete(struct dirvec *dv, struct directory *del)