summaryrefslogtreecommitdiff
path: root/playlist.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-01-02 13:15:11 +0100
committerGravatar waker <wakeroid@gmail.com>2011-01-02 13:15:11 +0100
commit865bb1c6a761c4963ddeab0c5ce3dc1d3ba2ab46 (patch)
treeb353db7936da8be915a8c30e42f5c8287679136f /playlist.c
parent4c90be31a1be29701c3fcca0cd67cb2114e18e15 (diff)
preserve metadata loading order
Diffstat (limited to 'playlist.c')
-rw-r--r--playlist.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/playlist.c b/playlist.c
index e36a2317..8c9359b4 100644
--- a/playlist.c
+++ b/playlist.c
@@ -1767,6 +1767,7 @@ void
pl_add_meta (playItem_t *it, const char *key, const char *value) {
LOCK;
// check if it's already set
+ DB_metaInfo_t *tail = NULL;
DB_metaInfo_t *m = it->meta;
while (m) {
if (!strcasecmp (key, m->key)) {
@@ -1774,6 +1775,7 @@ pl_add_meta (playItem_t *it, const char *key, const char *value) {
UNLOCK;
return;
}
+ tail = m;
m = m->next;
}
// add
@@ -1804,8 +1806,14 @@ pl_add_meta (playItem_t *it, const char *key, const char *value) {
m = malloc (sizeof (DB_metaInfo_t));
m->key = metacache_add_string (key); //key;
m->value = metacache_add_string (value); //strdup (value);
- m->next = it->meta;
- it->meta = m;
+ m->next = NULL;
+
+ if (tail) {
+ tail->next = m;
+ }
+ else {
+ it->meta = m;
+ }
UNLOCK;
}