aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-03 11:16:25 +0100
committerMax Kellermann <max@duempel.org>2013-12-03 13:16:43 +0100
commit4ab586aaf11c8333ac6a245adfb660dca73fd5cd (patch)
treec7baf5387ca81e5f707da6122fde3e4ecae5434e /src/tag
parent8a5209ad93f860572b3545d56bc6f170449be1dc (diff)
downloadmpd-4ab586aaf11c8333ac6a245adfb660dca73fd5cd.tar.gz
mpd-4ab586aaf11c8333ac6a245adfb660dca73fd5cd.tar.xz
mpd-4ab586aaf11c8333ac6a245adfb660dca73fd5cd.zip
Tag: use new[]/delete[] instead of g_new()/g_free()
Diffstat (limited to 'src/tag')
-rw-r--r--src/tag/Tag.cxx13
-rw-r--r--src/tag/TagBuilder.cxx2
2 files changed, 4 insertions, 11 deletions
diff --git a/src/tag/Tag.cxx b/src/tag/Tag.cxx
index e212c69a2..7070d39c2 100644
--- a/src/tag/Tag.cxx
+++ b/src/tag/Tag.cxx
@@ -25,7 +25,6 @@
#include "TagBuilder.hxx"
#include "util/ASCII.hxx"
-#include <glib.h>
#include <assert.h>
#include <string.h>
@@ -59,12 +58,6 @@ tag_name_parse_i(const char *name)
return TAG_NUM_OF_ITEM_TYPES;
}
-static size_t
-items_size(const Tag &tag)
-{
- return tag.num_items * sizeof(TagItem *);
-}
-
void
Tag::Clear()
{
@@ -76,7 +69,7 @@ Tag::Clear()
tag_pool_put_item(items[i]);
tag_pool_lock.unlock();
- g_free(items);
+ delete[] items;
items = nullptr;
num_items = 0;
}
@@ -88,7 +81,7 @@ Tag::~Tag()
tag_pool_put_item(items[i]);
tag_pool_lock.unlock();
- g_free(items);
+ delete[] items;
}
Tag::Tag(const Tag &other)
@@ -97,7 +90,7 @@ Tag::Tag(const Tag &other)
num_items(other.num_items)
{
if (num_items > 0) {
- items = (TagItem **)g_malloc(items_size(other));
+ items = new TagItem *[num_items];
tag_pool_lock.lock();
for (unsigned i = 0; i < num_items; i++)
diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx
index 5c7da2a1a..37aa08cee 100644
--- a/src/tag/TagBuilder.cxx
+++ b/src/tag/TagBuilder.cxx
@@ -125,7 +125,7 @@ TagBuilder::Commit(Tag &tag)
object */
const unsigned n_items = items.size();
tag.num_items = n_items;
- tag.items = g_new(TagItem *, n_items);
+ tag.items = new TagItem *[n_items];
std::copy_n(items.begin(), n_items, tag.items);
items.clear();