diff options
author | Max Kellermann <max@duempel.org> | 2013-01-30 09:13:46 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-30 09:13:46 +0100 |
commit | f8ff45b212c0c666d676dba9df0936a3bf6e98a5 (patch) | |
tree | 7d86096c8a4e3cf46feb070ddb09f4101728bc41 | |
parent | f5c0b0d3168d6c34010f86a4b6878b7181d10237 (diff) | |
download | mpd-f8ff45b212c0c666d676dba9df0936a3bf6e98a5.tar.gz mpd-f8ff45b212c0c666d676dba9df0936a3bf6e98a5.tar.xz mpd-f8ff45b212c0c666d676dba9df0936a3bf6e98a5.zip |
icy_server: pass pointer to _metadata_page()
Don't use va_list.
-rw-r--r-- | src/icy_server.c | 18 | ||||
-rw-r--r-- | src/icy_server.h | 4 | ||||
-rw-r--r-- | src/output/HttpdOutputPlugin.cxx | 9 |
3 files changed, 10 insertions, 21 deletions
diff --git a/src/icy_server.c b/src/icy_server.c index b6c89eaf6..4971bc0ee 100644 --- a/src/icy_server.c +++ b/src/icy_server.c @@ -85,9 +85,8 @@ icy_server_metadata_string(const char *stream_title, const char* stream_url) } struct page* -icy_server_metadata_page(const struct tag *tag, ...) +icy_server_metadata_page(const struct tag *tag, const enum tag_type *types) { - va_list args; const gchar *tag_items[TAG_NUM_OF_ITEM_TYPES]; gint last_item, item; guint position; @@ -100,22 +99,11 @@ icy_server_metadata_page(const struct tag *tag, ...) last_item = -1; - va_start(args, tag); - while (1) { - enum tag_type type; - const gchar *tag_item; - - type = va_arg(args, enum tag_type); - - if (type == TAG_NUM_OF_ITEM_TYPES) - break; - - tag_item = tag_get_value(tag, type); - + while (*types != TAG_NUM_OF_ITEM_TYPES) { + const gchar *tag_item = tag_get_value(tag, *types); if (tag_item) tag_items[++last_item] = tag_item; } - va_end(args); position = item = 0; while (position < sizeof(stream_title) && item <= last_item) { diff --git a/src/icy_server.h b/src/icy_server.h index 17fb391ba..15f6f36b7 100644 --- a/src/icy_server.h +++ b/src/icy_server.h @@ -23,8 +23,6 @@ #include "page.h" #include "tag.h" -#include <stdarg.h> - #ifdef __cplusplus extern "C" { #endif @@ -35,7 +33,7 @@ icy_server_metadata_header(const char *name, const char *content_type, int metaint); struct page* -icy_server_metadata_page(const struct tag *tag, ...); +icy_server_metadata_page(const struct tag *tag, const enum tag_type *types); #ifdef __cplusplus } diff --git a/src/output/HttpdOutputPlugin.cxx b/src/output/HttpdOutputPlugin.cxx index 8d46a0228..c6367cd21 100644 --- a/src/output/HttpdOutputPlugin.cxx +++ b/src/output/HttpdOutputPlugin.cxx @@ -505,9 +505,12 @@ HttpdOutput::SendTag(const struct tag *tag) if (metadata != NULL) page_unref(metadata); - metadata = icy_server_metadata_page(tag, TAG_ALBUM, - TAG_ARTIST, TAG_TITLE, - TAG_NUM_OF_ITEM_TYPES); + static constexpr tag_type types[] = { + TAG_ALBUM, TAG_ARTIST, TAG_TITLE, + TAG_NUM_OF_ITEM_TYPES + }; + + metadata = icy_server_metadata_page(tag, &types[0]); if (metadata != NULL) { const ScopeLock protect(mutex); for (auto &client : clients) |