aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-08 16:35:09 +0100
committerMax Kellermann <max@duempel.org>2013-01-08 16:35:09 +0100
commit6cafec8ae6181aae095bf546e576c6b5f40cd41c (patch)
tree34bfce795ee458a2c22787d17b48ac16622bc972
parent8ef87be4829a260893ababa1ff943a8cf1afa0b2 (diff)
downloadmpd-6cafec8ae6181aae095bf546e576c6b5f40cd41c.tar.gz
mpd-6cafec8ae6181aae095bf546e576c6b5f40cd41c.tar.xz
mpd-6cafec8ae6181aae095bf546e576c6b5f40cd41c.zip
Queue: allocate memory with new/delete
Diffstat (limited to '')
-rw-r--r--src/Queue.cxx10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Queue.cxx b/src/Queue.cxx
index 0c2a8fc9f..97dfb5b44 100644
--- a/src/Queue.cxx
+++ b/src/Queue.cxx
@@ -26,8 +26,8 @@
queue::queue(unsigned _max_length)
:max_length(_max_length), length(0),
version(1),
- items(g_new(Item, max_length)),
- order((unsigned *)g_malloc(sizeof(order[0]) * max_length)),
+ items(new Item[max_length]),
+ order(new unsigned[max_length]),
id_table(max_length * HASH_MULT),
repeat(false),
single(false),
@@ -40,8 +40,8 @@ queue::~queue()
{
Clear();
- g_free(items);
- g_free(order);
+ delete[] items;
+ delete[] order;
}
int
@@ -290,7 +290,7 @@ queue_item_compare_order_priority(gconstpointer av, gconstpointer bv,
uint8_t a = queue->items[*ap].priority;
uint8_t b = queue->items[*bp].priority;
- if (G_LIKELY(a == b))
+ if (gcc_likely(a == b))
return 0;
else if (a > b)
return -1;