aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-29 15:04:49 +0200
committerMax Kellermann <max@duempel.org>2008-08-29 15:04:49 +0200
commitd38d2bc3533dcfb661a3cbb8bd6cd9574c31ab69 (patch)
tree2c50a2528b0b2e56a6b1749385b2290150810e5b /src/tag.c
parentd8ad109e10c547ed4167daa9117a09d432b1b571 (diff)
downloadmpd-d38d2bc3533dcfb661a3cbb8bd6cd9574c31ab69.tar.gz
mpd-d38d2bc3533dcfb661a3cbb8bd6cd9574c31ab69.tar.xz
mpd-d38d2bc3533dcfb661a3cbb8bd6cd9574c31ab69.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 'src/tag.c')
-rw-r--r--src/tag.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tag.c b/src/tag.c
index 1dffeef41..d76ba5d95 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -313,9 +313,11 @@ struct tag *tag_dup(const struct 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;