aboutsummaryrefslogtreecommitdiffstats
path: root/src/output
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-10-15 23:14:34 +0200
committerMax Kellermann <max@duempel.org>2013-10-15 23:14:34 +0200
commit328131b7aa4344bc188b991f4c24a69d9739d4d2 (patch)
treea3cd9e7eae4b1e355068fa03571da27b91c0bfe3 /src/output
parent85003429af53a7f0de680bb7daf34744943b30e0 (diff)
downloadmpd-328131b7aa4344bc188b991f4c24a69d9739d4d2.tar.gz
mpd-328131b7aa4344bc188b991f4c24a69d9739d4d2.tar.xz
mpd-328131b7aa4344bc188b991f4c24a69d9739d4d2.zip
output/roar: use const_cast instead of g_strdup()
Diffstat (limited to '')
-rw-r--r--src/output/RoarOutputPlugin.cxx12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/output/RoarOutputPlugin.cxx b/src/output/RoarOutputPlugin.cxx
index 8321fd671..1dcd7442d 100644
--- a/src/output/RoarOutputPlugin.cxx
+++ b/src/output/RoarOutputPlugin.cxx
@@ -27,8 +27,6 @@
#include "util/Domain.hxx"
#include "Log.hxx"
-#include <glib.h>
-
#include <string>
/* libroar/services.h declares roar_service_stream::new - work around
@@ -372,14 +370,13 @@ RoarOutput::SendTag(const Tag &tag)
size_t cnt = 1;
struct roar_keyval vals[32];
- memset(vals, 0, sizeof(vals));
char uuid_buf[32][64];
char timebuf[16];
snprintf(timebuf, sizeof(timebuf), "%02d:%02d:%02d",
tag.time / 3600, (tag.time % 3600) / 60, tag.time % 60);
- vals[0].key = g_strdup("LENGTH");
+ vals[0].key = const_cast<char *>("LENGTH");
vals[0].value = timebuf;
for (unsigned i = 0; i < tag.num_items && cnt < 32; i++)
@@ -388,13 +385,13 @@ RoarOutput::SendTag(const Tag &tag)
const char *key = roar_tag_convert(tag.items[i]->type,
&is_uuid);
if (key != nullptr) {
+ vals[cnt].key = const_cast<char *>(key);
+
if (is_uuid) {
snprintf(uuid_buf[cnt], sizeof(uuid_buf[0]), "{UUID}%s",
tag.items[i]->value);
- vals[cnt].key = g_strdup(key);
vals[cnt].value = uuid_buf[cnt];
} else {
- vals[cnt].key = g_strdup(key);
vals[cnt].value = tag.items[i]->value;
}
@@ -403,9 +400,6 @@ RoarOutput::SendTag(const Tag &tag)
}
roar_vs_meta(vss, vals, cnt, &(err));
-
- for (unsigned i = 0; i < 32; i++)
- g_free(vals[i].key);
}
static void