aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/curl_input_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-02 20:45:50 +0100
committerMax Kellermann <max@duempel.org>2009-03-02 20:45:50 +0100
commit9a350acf0497acd19e05b77e6aa985552c13a94a (patch)
tree985bfbbc95a518a7b94351d2f1262be2daa08a62 /src/input/curl_input_plugin.c
parent36d24fb7eae3a7a761cb1659d10464f65ecdddf9 (diff)
downloadmpd-9a350acf0497acd19e05b77e6aa985552c13a94a.tar.gz
mpd-9a350acf0497acd19e05b77e6aa985552c13a94a.tar.xz
mpd-9a350acf0497acd19e05b77e6aa985552c13a94a.zip
input_plugin: added methods init(), finish()
Instead of hard-coding the plugin global initialization in input_stream_global_init(), make it walk the plugin list and initialize all plugins.
Diffstat (limited to '')
-rw-r--r--src/input/curl_input_plugin.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c
index b6d444a8a..a80c67d63 100644
--- a/src/input/curl_input_plugin.c
+++ b/src/input/curl_input_plugin.c
@@ -91,17 +91,23 @@ struct input_curl {
/** libcurl should accept "ICY 200 OK" */
static struct curl_slist *http_200_aliases;
-void input_curl_global_init(void)
+static bool
+input_curl_init(void)
{
CURLcode code = curl_global_init(CURL_GLOBAL_ALL);
- if (code != CURLE_OK)
+ if (code != CURLE_OK) {
g_warning("curl_global_init() failed: %s\n",
curl_easy_strerror(code));
+ return false;
+ }
http_200_aliases = curl_slist_append(http_200_aliases, "ICY 200 OK");
+
+ return true;
}
-void input_curl_global_finish(void)
+static void
+input_curl_finish(void)
{
curl_slist_free_all(http_200_aliases);
@@ -948,6 +954,9 @@ input_curl_open(struct input_stream *is, const char *url)
}
const struct input_plugin input_plugin_curl = {
+ .init = input_curl_init,
+ .finish = input_curl_finish,
+
.open = input_curl_open,
.close = input_curl_close,
.tag = input_curl_tag,