aboutsummaryrefslogtreecommitdiffstats
path: root/src/input_curl.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-26 20:38:44 +0100
committerMax Kellermann <max@duempel.org>2008-10-26 20:38:44 +0100
commitf08041f0eb8512304584b583073508629a934c88 (patch)
tree6a0d548ac1ee174b5505abe621fcb6f67afc688b /src/input_curl.c
parentdbc7e9ba2f57c71a9b73cd6d035ba2906190be72 (diff)
downloadmpd-f08041f0eb8512304584b583073508629a934c88.tar.gz
mpd-f08041f0eb8512304584b583073508629a934c88.tar.xz
mpd-f08041f0eb8512304584b583073508629a934c88.zip
input_stream: added struct input_plugin
Instead of managing a set of method pointers in each input_stream struct, move these into the new input_plugin struct. Each input_stream has only a pointer to the plugin struct. Pointers to all implementations are kept in the array "input_plugins".
Diffstat (limited to 'src/input_curl.c')
-rw-r--r--src/input_curl.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/input_curl.c b/src/input_curl.c
index fc78adca0..09e73c3e2 100644
--- a/src/input_curl.c
+++ b/src/input_curl.c
@@ -452,7 +452,8 @@ input_curl_seek(struct input_stream *is, mpd_unused long offset,
return 0;
}
-bool input_curl_open(struct input_stream *is, char *url)
+static bool
+input_curl_open(struct input_stream *is, const char *url)
{
struct input_curl *c;
bool ret;
@@ -483,11 +484,14 @@ bool input_curl_open(struct input_stream *is, char *url)
return false;
}
- is->seekFunc = input_curl_seek;
- is->closeFunc = input_curl_close;
- is->readFunc = input_curl_read;
- is->atEOFFunc = input_curl_eof;
- is->bufferFunc = input_curl_buffer;
-
return true;
}
+
+const struct input_plugin input_plugin_curl = {
+ .open = input_curl_open,
+ .close = input_curl_close,
+ .buffer = input_curl_buffer,
+ .read = input_curl_read,
+ .eof = input_curl_eof,
+ .seek = input_curl_seek,
+};