diff options
author | Max Kellermann <max@duempel.org> | 2008-09-19 16:37:06 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-19 16:37:06 +0200 |
commit | 20b724c08772ecef49b4db36516fc033c7517fa5 (patch) | |
tree | 97acb5df12a47e1f395a612d1f818ba4bc4bf7db /src/filelist.c | |
parent | c6cdd058cceafeac43ff5f792928d9bf731ca0f8 (diff) | |
download | mpd-20b724c08772ecef49b4db36516fc033c7517fa5.tar.gz mpd-20b724c08772ecef49b4db36516fc033c7517fa5.tar.xz mpd-20b724c08772ecef49b4db36516fc033c7517fa5.zip |
filelist: allocate entries with g_slice_alloc()
In this case, slices are faster. Also fix a memory leak in
filelist_prepend() which I simply forgot about in the last patch set.
Diffstat (limited to 'src/filelist.c')
-rw-r--r-- | src/filelist.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/filelist.c b/src/filelist.c index 6cbca39df..e21722ec4 100644 --- a/src/filelist.c +++ b/src/filelist.c @@ -57,7 +57,7 @@ filelist_free(struct filelist *filelist) 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; @@ -70,14 +70,12 @@ filelist_append(struct filelist *filelist, struct mpd_InfoEntity *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; |