dirvec: don't call g_path_get_basename() on parameter
This overhead is completely useless, because no caller expects this behaviour.
This commit is contained in:
parent
5d5c753c74
commit
a0fcd0cf22
13
src/dirvec.c
13
src/dirvec.c
@ -50,22 +50,15 @@ void dirvec_sort(struct dirvec *dv)
|
|||||||
|
|
||||||
struct directory *dirvec_find(const struct dirvec *dv, const char *path)
|
struct directory *dirvec_find(const struct dirvec *dv, const char *path)
|
||||||
{
|
{
|
||||||
char *base;
|
|
||||||
int i;
|
int i;
|
||||||
struct directory *ret = NULL;
|
|
||||||
|
|
||||||
base = g_path_get_basename(path);
|
|
||||||
|
|
||||||
db_lock();
|
db_lock();
|
||||||
for (i = dv->nr; --i >= 0; )
|
for (i = dv->nr; --i >= 0; )
|
||||||
if (!strcmp(directory_get_name(dv->base[i]), base)) {
|
if (!strcmp(directory_get_name(dv->base[i]), path))
|
||||||
ret = dv->base[i];
|
return dv->base[i];
|
||||||
break;
|
|
||||||
}
|
|
||||||
db_unlock();
|
db_unlock();
|
||||||
|
|
||||||
g_free(base);
|
return NULL;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int dirvec_delete(struct dirvec *dv, struct directory *del)
|
int dirvec_delete(struct dirvec *dv, struct directory *del)
|
||||||
|
Loading…
Reference in New Issue
Block a user