aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-29 15:04:49 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-02 00:20:41 -0700
commitad6fadbd47ccdf16477bd0b65cdca90c21c3041d (patch)
tree2fd7eaa40a4b4f7b070bac0e2239a154aa409f61 /src/tag.c
parentfbe650b1e022f6ca69cc95d79019f218f450e791 (diff)
downloadmpd-ad6fadbd47ccdf16477bd0b65cdca90c21c3041d.tar.gz
mpd-ad6fadbd47ccdf16477bd0b65cdca90c21c3041d.tar.xz
mpd-ad6fadbd47ccdf16477bd0b65cdca90c21c3041d.zip
tag: optimize tag_dup(), copy item references
Don't call tag_pool_get_item() for duplicating tags, just increase the item's reference counter instead.
Diffstat (limited to '')
-rw-r--r--src/tag.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tag.c b/src/tag.c
index cd5e227c1..ee26e271d 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -313,9 +313,11 @@ struct mpd_tag *tag_dup(const struct mpd_tag *tag)
ret = tag_new();
ret->time = tag->time;
+ ret->numOfItems = tag->numOfItems;
+ ret->items = xmalloc(ret->numOfItems * sizeof(ret->items[0]));
for (i = 0; i < tag->numOfItems; i++) {
- tag_add_item(ret, tag->items[i]->type, tag->items[i]->value);
+ ret->items[i] = tag_pool_dup_item(tag->items[i]);
}
return ret;