aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputPlugin.c
diff options
context:
space:
mode:
authorAvuton Olrich <avuton@gmail.com>2006-07-20 16:02:40 +0000
committerAvuton Olrich <avuton@gmail.com>2006-07-20 16:02:40 +0000
commit29a25b9933b32800f58dd73d5d1fc21993071c92 (patch)
tree4f456a6f8e44d42acc289c35534ea3e59c0aa96f /src/inputPlugin.c
parent099f0e103f7591eef81183292d704b3a77a99018 (diff)
downloadmpd-29a25b9933b32800f58dd73d5d1fc21993071c92.tar.gz
mpd-29a25b9933b32800f58dd73d5d1fc21993071c92.tar.xz
mpd-29a25b9933b32800f58dd73d5d1fc21993071c92.zip
Add mpd-indent.sh
Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/inputPlugin.c')
-rw-r--r--src/inputPlugin.c100
1 files changed, 59 insertions, 41 deletions
diff --git a/src/inputPlugin.c b/src/inputPlugin.c
index 14844bdf7..80781774b 100644
--- a/src/inputPlugin.c
+++ b/src/inputPlugin.c
@@ -24,47 +24,59 @@
#include <stdlib.h>
#include <string.h>
-static List * inputPlugin_list = NULL;
+static List *inputPlugin_list = NULL;
-void loadInputPlugin(InputPlugin * inputPlugin) {
- if(!inputPlugin) return;
- if(!inputPlugin->name) return;
+void loadInputPlugin(InputPlugin * inputPlugin)
+{
+ if (!inputPlugin)
+ return;
+ if (!inputPlugin->name)
+ return;
- if(inputPlugin->initFunc && inputPlugin->initFunc() < 0) return;
+ if (inputPlugin->initFunc && inputPlugin->initFunc() < 0)
+ return;
insertInList(inputPlugin_list, inputPlugin->name, (void *)inputPlugin);
}
-void unloadInputPlugin(InputPlugin * inputPlugin) {
- if(inputPlugin->finishFunc) inputPlugin->finishFunc();
+void unloadInputPlugin(InputPlugin * inputPlugin)
+{
+ if (inputPlugin->finishFunc)
+ inputPlugin->finishFunc();
deleteFromList(inputPlugin_list, inputPlugin->name);
}
-static int stringFoundInStringArray(char ** array, char * suffix) {
- while(array && *array) {
- if(strcasecmp(*array, suffix) == 0) return 1;
+static int stringFoundInStringArray(char **array, char *suffix)
+{
+ while (array && *array) {
+ if (strcasecmp(*array, suffix) == 0)
+ return 1;
array++;
}
-
+
return 0;
}
-InputPlugin * getInputPluginFromSuffix(char * suffix, unsigned int next) {
- static ListNode * pos = NULL;
- ListNode * node;
- InputPlugin * plugin;
+InputPlugin *getInputPluginFromSuffix(char *suffix, unsigned int next)
+{
+ static ListNode *pos = NULL;
+ ListNode *node;
+ InputPlugin *plugin;
+
+ if (suffix == NULL)
+ return NULL;
- if(suffix == NULL) return NULL;
-
if (next) {
- if (pos) node = pos;
- else return NULL;
+ if (pos)
+ node = pos;
+ else
+ return NULL;
} else
node = inputPlugin_list->firstNode;
- while(node != NULL) {
+ while (node != NULL) {
plugin = node->data;
- if(stringFoundInStringArray(plugin->suffixes, suffix)) {
+ if (stringFoundInStringArray(plugin->suffixes, suffix)) {
pos = node->nextNode;
return plugin;
}
@@ -74,18 +86,20 @@ InputPlugin * getInputPluginFromSuffix(char * suffix, unsigned int next) {
return NULL;
}
-InputPlugin * getInputPluginFromMimeType(char * mimeType, unsigned int next) {
- static ListNode * pos = NULL;
- ListNode * node;
- InputPlugin * plugin;
+InputPlugin *getInputPluginFromMimeType(char *mimeType, unsigned int next)
+{
+ static ListNode *pos = NULL;
+ ListNode *node;
+ InputPlugin *plugin;
+
+ if (mimeType == NULL)
+ return NULL;
- if(mimeType == NULL) return NULL;
-
node = (next && pos) ? pos : inputPlugin_list->firstNode;
- while(node != NULL) {
+ while (node != NULL) {
plugin = node->data;
- if(stringFoundInStringArray(plugin->mimeTypes, mimeType)) {
+ if (stringFoundInStringArray(plugin->mimeTypes, mimeType)) {
pos = node->nextNode;
return plugin;
}
@@ -95,23 +109,25 @@ InputPlugin * getInputPluginFromMimeType(char * mimeType, unsigned int next) {
return NULL;
}
-InputPlugin * getInputPluginFromName(char * name) {
- void * plugin = NULL;
+InputPlugin *getInputPluginFromName(char *name)
+{
+ void *plugin = NULL;
findInList(inputPlugin_list, name, &plugin);
- return (InputPlugin *)plugin;
+ return (InputPlugin *) plugin;
}
-void printAllInputPluginSuffixes(FILE * fp) {
- ListNode * node = inputPlugin_list->firstNode;
- InputPlugin * plugin;
- char ** suffixes;
+void printAllInputPluginSuffixes(FILE * fp)
+{
+ ListNode *node = inputPlugin_list->firstNode;
+ InputPlugin *plugin;
+ char **suffixes;
- while(node) {
- plugin = (InputPlugin *)node->data;
+ while (node) {
+ plugin = (InputPlugin *) node->data;
suffixes = plugin->suffixes;
- while(suffixes && *suffixes) {
+ while (suffixes && *suffixes) {
myfprintf(fp, "%s ", *suffixes);
suffixes++;
}
@@ -130,7 +146,8 @@ extern InputPlugin mpcPlugin;
extern InputPlugin aacPlugin;
extern InputPlugin modPlugin;
-void initInputPlugins(void) {
+void initInputPlugins(void)
+{
inputPlugin_list = makeList(NULL, 1);
/* load plugins here */
@@ -144,6 +161,7 @@ void initInputPlugins(void) {
loadInputPlugin(&modPlugin);
}
-void finishInputPlugins(void) {
+void finishInputPlugins(void)
+{
freeList(inputPlugin_list);
}