summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c6cdd05)
raw | patch | inline | side by side (parent: c6cdd05)
author | Max Kellermann <max@duempel.org> | |
Fri, 19 Sep 2008 14:37:06 +0000 (16:37 +0200) | ||
committer | Max Kellermann <max@duempel.org> | |
Fri, 19 Sep 2008 14:37:06 +0000 (16:37 +0200) |
In this case, slices are faster. Also fix a memory leak in
filelist_prepend() which I simply forgot about in the last patch set.
filelist_prepend() which I simply forgot about in the last patch set.
src/filelist.c | patch | blob | history |
diff --git a/src/filelist.c b/src/filelist.c
index 6cbca39df5622361113585f7f88949bf7a559057..e21722ec4dd14bf7f79dcd362b464d1f6d12eb26 100644 (file)
--- a/src/filelist.c
+++ b/src/filelist.c
struct filelist_entry *
filelist_append(struct filelist *filelist, struct mpd_InfoEntity *entity)
{
- struct filelist_entry *entry = g_malloc(sizeof(*entry));
+ struct filelist_entry *entry = g_slice_alloc(sizeof(*entry));
entry->flags = 0;
entry->entity = entity;
struct filelist_entry *
filelist_prepend(struct filelist *filelist, struct mpd_InfoEntity *entity)
{
- struct filelist_entry *entry = g_malloc(sizeof(*entry));
+ struct filelist_entry *entry = filelist_append(filelist, entity);
/* this is very slow, but we should optimize screen_artist.c
later so that this function can be removed, so I'm not in
the mood to implement something better here */
- entry = filelist_append(filelist, entity);
-
if (!filelist_is_empty(filelist)) {
guint i;