diff options
author | Max Kellermann <max@duempel.org> | 2008-08-29 15:04:49 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-08-29 15:04:49 +0200 |
commit | d38d2bc3533dcfb661a3cbb8bd6cd9574c31ab69 (patch) | |
tree | 2c50a2528b0b2e56a6b1749385b2290150810e5b /src/tag.c | |
parent | d8ad109e10c547ed4167daa9117a09d432b1b571 (diff) | |
download | mpd-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.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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; |