diff options
author | Max Kellermann <max@duempel.org> | 2008-09-19 16:25:28 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-09-19 16:25:28 +0200 |
commit | fac79e52e8347a26f8bbcc9d97d38ee3807d2805 (patch) | |
tree | ba8e71547c8e67c2c1bc9ecbdfa27675f103cf59 /src/utils.c | |
parent | 6bf491217a2543365118839d616933ba43879dda (diff) | |
download | mpd-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 '')
-rw-r--r-- | src/utils.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/utils.c b/src/utils.c index 65eaceca2..574b8fa49 100644 --- a/src/utils.c +++ b/src/utils.c @@ -75,16 +75,16 @@ string_list_remove(GList *string_list, const gchar *str) GList * gcmp_list_from_path(mpdclient_t *c, const gchar *path, GList *list, gint types) { - GList *flist = NULL; + guint i; mpdclient_filelist_t *filelist; if ((filelist = mpdclient_filelist_get(c, path)) == NULL) return list; D("retrieved filelist!\n"); - flist = filelist->list; - while (flist) { - filelist_entry_t *entry = flist->data; + + for (i = 0; i < filelist_length(filelist); ++i) { + struct filelist_entry *entry = filelist_get(filelist, i); mpd_InfoEntity *entity = entry ? entry->entity : NULL; char *name = NULL; @@ -112,8 +112,6 @@ gcmp_list_from_path(mpdclient_t *c, const gchar *path, GList *list, gint types) if (name) list = g_list_append(list, name); - - flist = flist->next; } filelist_free(filelist); |