aboutsummaryrefslogtreecommitdiffstats
path: root/src/filelist.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-19 16:25:28 +0200
committerMax Kellermann <max@duempel.org>2008-09-19 16:25:28 +0200
commitfac79e52e8347a26f8bbcc9d97d38ee3807d2805 (patch)
treeba8e71547c8e67c2c1bc9ecbdfa27675f103cf59 /src/filelist.h
parent6bf491217a2543365118839d616933ba43879dda (diff)
downloadmpd-fac79e52e8347a26f8bbcc9d97d38ee3807d2805.tar.gz
mpd-fac79e52e8347a26f8bbcc9d97d38ee3807d2805.tar.xz
mpd-fac79e52e8347a26f8bbcc9d97d38ee3807d2805.zip
filelist: use GPtrArray instead of GList
Since we do a lot of indexed accesses to the filelist, a linked list doesn't seem appropriate. Use GPtrArray instead.
Diffstat (limited to 'src/filelist.h')
-rw-r--r--src/filelist.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/filelist.h b/src/filelist.h
index e2425d787..d96a67c9d 100644
--- a/src/filelist.h
+++ b/src/filelist.h
@@ -33,14 +33,11 @@ typedef struct filelist {
/* path */
gchar *path;
- /* list length */
- guint length;
-
/* true if the list is updated */
gboolean updated;
/* the list */
- GList *list;
+ GPtrArray *entries;
} mpdclient_filelist_t;
struct filelist *
@@ -52,7 +49,7 @@ filelist_free(struct filelist *filelist);
static inline guint
filelist_length(const struct filelist *filelist)
{
- return filelist->length;
+ return filelist->entries->len;
}
static inline gboolean
@@ -64,8 +61,7 @@ filelist_is_empty(const struct filelist *filelist)
static inline struct filelist_entry *
filelist_get(const struct filelist *filelist, guint i)
{
- return (struct filelist_entry*)
- g_list_nth_data(filelist->list, i);
+ return g_ptr_array_index(filelist->entries, i);
}
struct filelist_entry *