aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-17 20:23:27 +0100
committerMax Kellermann <max@duempel.org>2009-01-17 20:23:27 +0100
commit4d472c265ed0b3f7f61ee624c01c8ef319db7c99 (patch)
tree8ec3ea874c741c9b0e1ab70db2a96e02acec8225 /src
parent2bbf378dd8a3f12b4b79228ce562402c29d2cd09 (diff)
downloadmpd-4d472c265ed0b3f7f61ee624c01c8ef319db7c99.tar.gz
mpd-4d472c265ed0b3f7f61ee624c01c8ef319db7c99.tar.xz
mpd-4d472c265ed0b3f7f61ee624c01c8ef319db7c99.zip
conf: no CamelCase, part I
Renamed functions, types, variables.
Diffstat (limited to 'src')
-rw-r--r--src/audio.c12
-rw-r--r--src/audio.h4
-rw-r--r--src/client.c10
-rw-r--r--src/cmdline.c8
-rw-r--r--src/conf.c112
-rw-r--r--src/conf.h43
-rw-r--r--src/daemon.c3
-rw-r--r--src/database.c2
-rw-r--r--src/input_curl.c16
-rw-r--r--src/listen.c10
-rw-r--r--src/log.c6
-rw-r--r--src/main.c12
-rw-r--r--src/mapper.c6
-rw-r--r--src/mixer/alsa_mixer.c6
-rw-r--r--src/mixer/oss_mixer.c6
-rw-r--r--src/mixer_api.c2
-rw-r--r--src/mixer_api.h4
-rw-r--r--src/output/alsa_plugin.c11
-rw-r--r--src/output/ao_plugin.c9
-rw-r--r--src/output/fifo_plugin.c4
-rw-r--r--src/output/jack_plugin.c4
-rw-r--r--src/output/mvp_plugin.c2
-rw-r--r--src/output/null_plugin.c2
-rw-r--r--src/output/oss_plugin.c11
-rw-r--r--src/output/osx_plugin.c2
-rw-r--r--src/output/pulse_plugin.c6
-rw-r--r--src/output/shout_plugin.c4
-rw-r--r--src/output_api.h2
-rw-r--r--src/output_control.h3
-rw-r--r--src/output_init.c5
-rw-r--r--src/path.c3
-rw-r--r--src/permission.c8
-rw-r--r--src/playerData.c6
-rw-r--r--src/playlist.c4
-rw-r--r--src/replay_gain.c4
-rw-r--r--src/state_file.c2
-rw-r--r--src/tag.c4
-rw-r--r--src/utils.c2
-rw-r--r--src/volume.c10
-rw-r--r--src/zeroconf.c4
40 files changed, 204 insertions, 170 deletions
diff --git a/src/audio.c b/src/audio.c
index 4b3a60718..78d07a5a9 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -43,9 +43,9 @@ static unsigned int audioOutputArraySize;
unsigned int audio_output_count(void)
{
unsigned int nr = 0;
- ConfigParam *param = NULL;
+ struct config_param *param = NULL;
- while ((param = getNextConfigParam(CONF_AUDIO_OUTPUT, param)))
+ while ((param = config_get_next_param(CONF_AUDIO_OUTPUT, param)))
nr++;
if (!nr)
nr = 1; /* we'll always have at least one device */
@@ -55,7 +55,7 @@ unsigned int audio_output_count(void)
/* make sure initPlayerData is called before this function!! */
void initAudioDriver(void)
{
- ConfigParam *param = NULL;
+ struct config_param *param = NULL;
unsigned int i;
notify_init(&audio_output_client_notify);
@@ -68,7 +68,7 @@ void initAudioDriver(void)
struct audio_output *output = &audioOutputArray[i];
unsigned int j;
- param = getNextConfigParam(CONF_AUDIO_OUTPUT, param);
+ param = config_get_next_param(CONF_AUDIO_OUTPUT, param);
/* only allow param to be NULL if there just one audioOutput */
assert(param || (audioOutputArraySize == 1));
@@ -106,7 +106,7 @@ void getOutputAudioFormat(const struct audio_format *inAudioFormat,
void initAudioConfig(void)
{
- ConfigParam *param = getConfigParam(CONF_AUDIO_OUTPUT_FORMAT);
+ struct config_param *param = config_get_param(CONF_AUDIO_OUTPUT_FORMAT);
if (NULL == param || NULL == param->value)
return;
@@ -467,7 +467,7 @@ bool mixer_control_getvol(unsigned int device, int *volume)
return false;
}
-bool mixer_configure_legacy(char *name, ConfigParam *param)
+bool mixer_configure_legacy(char *name, struct config_param *param)
{
unsigned i;
struct audio_output *output;
diff --git a/src/audio.h b/src/audio.h
index c83794689..9120b9573 100644
--- a/src/audio.h
+++ b/src/audio.h
@@ -21,13 +21,13 @@
#include <stdbool.h>
#include <stdio.h>
-#include "conf.h"
#define AUDIO_AO_DRIVER_DEFAULT "default"
struct audio_format;
struct tag;
struct client;
+struct config_param;
unsigned int audio_output_count(void);
@@ -73,6 +73,6 @@ void saveAudioDevicesState(FILE *fp);
bool mixer_control_setvol(unsigned int device, int volume, int rel);
bool mixer_control_getvol(unsigned int device, int *volume);
-bool mixer_configure_legacy(char *name, ConfigParam *param);
+bool mixer_configure_legacy(char *name, struct config_param *param);
#endif
diff --git a/src/client.c b/src/client.c
index e059f64fd..fa3698cb0 100644
--- a/src/client.c
+++ b/src/client.c
@@ -554,9 +554,9 @@ client_out_event(G_GNUC_UNUSED GIOChannel *source,
void client_manager_init(void)
{
char *test;
- ConfigParam *param;
+ struct config_param *param;
- param = getConfigParam(CONF_CONN_TIMEOUT);
+ param = config_get_param(CONF_CONN_TIMEOUT);
if (param) {
client_timeout = strtol(param->value, &test, 10);
@@ -567,7 +567,7 @@ void client_manager_init(void)
}
}
- param = getConfigParam(CONF_MAX_CONN);
+ param = config_get_param(CONF_MAX_CONN);
if (param) {
client_max_connections = strtol(param->value, &test, 10);
@@ -579,7 +579,7 @@ void client_manager_init(void)
} else
client_max_connections = CLIENT_MAX_CONNECTIONS_DEFAULT;
- param = getConfigParam(CONF_MAX_COMMAND_LIST_SIZE);
+ param = config_get_param(CONF_MAX_COMMAND_LIST_SIZE);
if (param) {
long tmp = strtol(param->value, &test, 10);
@@ -591,7 +591,7 @@ void client_manager_init(void)
client_max_command_list_size = tmp * 1024;
}
- param = getConfigParam(CONF_MAX_OUTPUT_BUFFER_SIZE);
+ param = config_get_param(CONF_MAX_OUTPUT_BUFFER_SIZE);
if (param) {
long tmp = strtol(param->value, &test, 10);
diff --git a/src/cmdline.c b/src/cmdline.c
index 14a22da34..71173ae38 100644
--- a/src/cmdline.c
+++ b/src/cmdline.c
@@ -143,17 +143,17 @@ void parseOptions(int argc, char **argv, Options *options)
path2 = g_build_filename(g_get_home_dir(),
USER_CONFIG_FILE_LOCATION2, NULL);
if (g_file_test(path1, G_FILE_TEST_IS_REGULAR))
- readConf(path1);
+ config_read_file(path1);
else if (g_file_test(path2, G_FILE_TEST_IS_REGULAR))
- readConf(path2);
+ config_read_file(path2);
else if (g_file_test(SYSTEM_CONFIG_FILE_LOCATION,
G_FILE_TEST_IS_REGULAR))
- readConf(SYSTEM_CONFIG_FILE_LOCATION);
+ config_read_file(SYSTEM_CONFIG_FILE_LOCATION);
g_free(path1);
g_free(path2);
} else if (argc == 2) {
/* specified configuration file */
- readConf(argv[1]);
+ config_read_file(argv[1]);
} else
g_error("too many arguments");
}
diff --git a/src/conf.c b/src/conf.c
index 1ae0520be..be4db9018 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -37,12 +37,12 @@
#define CONF_BLOCK_MASK 0x02
#define CONF_LINE_TOKEN_MAX 3
-typedef struct _configEntry {
+struct config_entry {
const char *name;
unsigned char mask;
GSList *params;
-} ConfigEntry;
+};
static GSList *config_entries;
@@ -63,9 +63,10 @@ static int get_bool(const char *value)
return CONF_BOOL_INVALID;
}
-ConfigParam *newConfigParam(const char *value, int line)
+struct config_param *
+newConfigParam(const char *value, int line)
{
- ConfigParam *ret = g_new(ConfigParam, 1);
+ struct config_param *ret = g_new(struct config_param, 1);
if (!value)
ret->value = NULL;
@@ -74,8 +75,8 @@ ConfigParam *newConfigParam(const char *value, int line)
ret->line = line;
- ret->numberOfBlockParams = 0;
- ret->blockParams = NULL;
+ ret->num_block_params = 0;
+ ret->block_params = NULL;
return ret;
}
@@ -83,26 +84,26 @@ ConfigParam *newConfigParam(const char *value, int line)
void
config_param_free(gpointer data, G_GNUC_UNUSED gpointer user_data)
{
- ConfigParam *param = data;
+ struct config_param *param = data;
int i;
g_free(param->value);
- for (i = 0; i < param->numberOfBlockParams; i++) {
- g_free(param->blockParams[i].name);
- g_free(param->blockParams[i].value);
+ for (i = 0; i < param->num_block_params; i++) {
+ g_free(param->block_params[i].name);
+ g_free(param->block_params[i].value);
}
- if (param->numberOfBlockParams)
- g_free(param->blockParams);
+ if (param->num_block_params)
+ g_free(param->block_params);
g_free(param);
}
-static ConfigEntry *
+static struct config_entry *
newConfigEntry(const char *name, int repeatable, int block)
{
- ConfigEntry *ret = g_new(ConfigEntry, 1);
+ struct config_entry *ret = g_new(struct config_entry, 1);
ret->name = name;
ret->mask = 0;
@@ -119,7 +120,7 @@ newConfigEntry(const char *name, int repeatable, int block)
static void
config_entry_free(gpointer data, G_GNUC_UNUSED gpointer user_data)
{
- ConfigEntry *entry = data;
+ struct config_entry *entry = data;
g_slist_foreach(entry->params, config_param_free, NULL);
g_slist_free(entry->params);
@@ -127,14 +128,14 @@ config_entry_free(gpointer data, G_GNUC_UNUSED gpointer user_data)
g_free(entry);
}
-static ConfigEntry *
+static struct config_entry *
config_entry_get(const char *name)
{
GSList *list;
for (list = config_entries; list != NULL;
list = g_slist_next(list)) {
- ConfigEntry *entry = list->data;
+ struct config_entry *entry = list->data;
if (strcmp(entry->name, name) == 0)
return entry;
}
@@ -144,7 +145,7 @@ config_entry_get(const char *name)
static void registerConfigParam(const char *name, int repeatable, int block)
{
- ConfigEntry *entry;
+ struct config_entry *entry;
entry = config_entry_get(name);
if (entry != NULL)
@@ -154,13 +155,13 @@ static void registerConfigParam(const char *name, int repeatable, int block)
config_entries = g_slist_prepend(config_entries, entry);
}
-void finishConf(void)
+void config_global_finish(void)
{
g_slist_foreach(config_entries, config_entry_free, NULL);
g_slist_free(config_entries);
}
-void initConf(void)
+void config_global_init(void)
{
config_entries = NULL;
@@ -209,24 +210,29 @@ void initConf(void)
registerConfigParam(CONF_GAPLESS_MP3_PLAYBACK, 0, 0);
}
-void addBlockParam(ConfigParam * param, const char *name, const char *value,
- int line)
+void
+addBlockParam(struct config_param * param, const char *name, const char *value,
+ int line)
{
- param->numberOfBlockParams++;
+ struct block_param *bp;
+
+ param->num_block_params++;
+
+ param->block_params = g_realloc(param->block_params,
+ param->num_block_params *
+ sizeof(param->block_params[0]));
- param->blockParams = g_realloc(param->blockParams,
- param->numberOfBlockParams *
- sizeof(BlockParam));
+ bp = &param->block_params[param->num_block_params - 1];
- param->blockParams[param->numberOfBlockParams - 1].name = g_strdup(name);
- param->blockParams[param->numberOfBlockParams - 1].value =
- g_strdup(value);
- param->blockParams[param->numberOfBlockParams - 1].line = line;
+ bp->name = g_strdup(name);
+ bp->value = g_strdup(value);
+ bp->line = line;
}
-static ConfigParam *readConfigBlock(FILE * fp, int *count, char *string)
+static struct config_param *
+config_read_fileigBlock(FILE * fp, int *count, char *string)
{
- ConfigParam *ret = newConfigParam(NULL, *count);
+ struct config_param *ret = newConfigParam(NULL, *count);
int i;
int numberOfArgs;
@@ -275,7 +281,7 @@ static ConfigParam *readConfigBlock(FILE * fp, int *count, char *string)
return ret;
}
-void readConf(const char *file)
+void config_read_file(const char *file)
{
FILE *fp;
char string[MAX_STRING_SIZE + 1];
@@ -283,8 +289,8 @@ void readConf(const char *file)
int numberOfArgs;
int argsMinusComment;
int count = 0;
- ConfigEntry *entry;
- ConfigParam *param;
+ struct config_entry *entry;
+ struct config_param *param;
if (!(fp = fopen(file, "r"))) {
g_error("problems opening file %s for reading: %s\n",
@@ -332,7 +338,7 @@ void readConf(const char *file)
g_error("improperly formatted config file at "
"line %i: %s\n", count, string);
}
- param = readConfigBlock(fp, &count, string);
+ param = config_read_fileigBlock(fp, &count, string);
} else
param = newConfigParam(array[1], count);
@@ -341,11 +347,12 @@ void readConf(const char *file)
fclose(fp);
}
-ConfigParam *getNextConfigParam(const char *name, ConfigParam * last)
+struct config_param *
+config_get_next_param(const char *name, struct config_param * last)
{
- ConfigEntry *entry;
+ struct config_entry *entry;
GSList *node;
- ConfigParam *param;
+ struct config_param *param;
entry = config_entry_get(name);
if (entry == NULL)
@@ -371,7 +378,7 @@ ConfigParam *getNextConfigParam(const char *name, ConfigParam * last)
char *getConfigParamValue(const char *name)
{
- ConfigParam *param = getConfigParam(name);
+ struct config_param *param = config_get_param(name);
if (!param)
return NULL;
@@ -379,28 +386,30 @@ char *getConfigParamValue(const char *name)
return param->value;
}
-BlockParam *getBlockParam(ConfigParam * param, const char *name)
+struct block_param *
+getBlockParam(struct config_param * param, const char *name)
{
- BlockParam *ret = NULL;
+ struct block_param *ret = NULL;
int i;
- for (i = 0; i < param->numberOfBlockParams; i++) {
- if (0 == strcmp(name, param->blockParams[i].name)) {
+ for (i = 0; i < param->num_block_params; i++) {
+ if (0 == strcmp(name, param->block_params[i].name)) {
if (ret) {
g_warning("\"%s\" first defined on line %i, and "
"redefined on line %i\n", name,
- ret->line, param->blockParams[i].line);
+ ret->line, param->block_params[i].line);
}
- ret = param->blockParams + i;
+ ret = param->block_params + i;
}
}
return ret;
}
-ConfigParam *parseConfigFilePath(const char *name, int force)
+struct config_param *
+parseConfigFilePath(const char *name, int force)
{
- ConfigParam *param = getConfigParam(name);
+ struct config_param *param = config_get_param(name);
char *path;
if (!param && force)
@@ -423,7 +432,7 @@ ConfigParam *parseConfigFilePath(const char *name, int force)
int getBoolConfigParam(const char *name, int force)
{
int ret;
- ConfigParam *param = getConfigParam(name);
+ struct config_param *param = config_get_param(name);
if (!param)
return CONF_BOOL_UNSET;
@@ -446,10 +455,11 @@ bool config_get_bool(const char *name, bool default_value)
return value;
}
-int getBoolBlockParam(ConfigParam *param, const char *name, int force)
+int
+getBoolBlockParam(struct config_param *param, const char *name, int force)
{
int ret;
- BlockParam *bp = getBlockParam(param, name);
+ struct block_param *bp = getBlockParam(param, name);
if (!bp)
return CONF_BOOL_UNSET;
diff --git a/src/conf.h b/src/conf.h
index a50273e6e..97713f0af 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -68,46 +68,57 @@
#define CONF_BOOL_UNSET -1
#define CONF_BOOL_INVALID -2
-typedef struct _BlockParam {
+struct block_param {
char *name;
char *value;
int line;
-} BlockParam;
+};
-typedef struct _ConfigParam {
+struct config_param {
char *value;
unsigned int line;
- BlockParam *blockParams;
- int numberOfBlockParams;
-} ConfigParam;
-void initConf(void);
-void finishConf(void);
+ struct block_param *block_params;
+ int num_block_params;
+};
-void readConf(const char *file);
+void config_global_init(void);
+void config_global_finish(void);
+
+void config_read_file(const char *file);
/* don't free the returned value
set _last_ to NULL to get first entry */
-ConfigParam *getNextConfigParam(const char *name, ConfigParam * last);
+struct config_param *
+config_get_next_param(const char *name, struct config_param *last);
-#define getConfigParam(name) getNextConfigParam(name, NULL)
+static inline struct config_param *
+config_get_param(const char *name)
+{
+ return config_get_next_param(name, NULL);
+}
char *getConfigParamValue(const char *name);
-BlockParam *getBlockParam(ConfigParam * param, const char *name);
+struct block_param *
+getBlockParam(struct config_param *param, const char *name);
-ConfigParam *parseConfigFilePath(const char *name, int force);
+struct config_param *
+parseConfigFilePath(const char *name, int force);
int getBoolConfigParam(const char *name, int force);
bool config_get_bool(const char *name, bool default_value);
-int getBoolBlockParam(ConfigParam *param, const char *name, int force);
+int
+getBoolBlockParam(struct config_param *param, const char *name, int force);
-ConfigParam *newConfigParam(const char *value, int line);
+struct config_param *
+newConfigParam(const char *value, int line);
void config_param_free(gpointer data, gpointer user_data);
-void addBlockParam(ConfigParam * param, const char *name, const char *value, int line);
+void
+addBlockParam(struct config_param *param, const char *name, const char *value, int line);
#endif
diff --git a/src/daemon.c b/src/daemon.c
index 8763b5b2e..566c59250 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -46,7 +46,8 @@ daemonize(Options *options)
{
#ifndef WIN32
FILE *fp = NULL;
- ConfigParam *pidFileParam = parseConfigFilePath(CONF_PID_FILE, 0);
+ struct config_param *pidFileParam =
+ parseConfigFilePath(CONF_PID_FILE, 0);
if (pidFileParam) {
/* do this before daemon'izing so we can fail gracefully if we can't
diff --git a/src/database.c b/src/database.c
index 717c47773..46c09281f 100644
--- a/src/database.c
+++ b/src/database.c
@@ -123,7 +123,7 @@ db_walk(const char *name,
static char *
db_get_file(void)
{
- ConfigParam *param = parseConfigFilePath(CONF_DB_FILE, 1);
+ struct config_param *param = parseConfigFilePath(CONF_DB_FILE, 1);
assert(param);
assert(param->value);
diff --git a/src/input_curl.c b/src/input_curl.c
index 84311d142..0ce648401 100644
--- a/src/input_curl.c
+++ b/src/input_curl.c
@@ -630,10 +630,10 @@ input_curl_easy_init(struct input_stream *is)
struct input_curl *c = is->data;
CURLcode code;
CURLMcode mcode;
- ConfigParam *proxy_host;
- ConfigParam *proxy_port;
- ConfigParam *proxy_user;
- ConfigParam *proxy_pass;
+ struct config_param *proxy_host;
+ struct config_param *proxy_port;
+ struct config_param *proxy_user;
+ struct config_param *proxy_pass;
c->eof = false;
@@ -661,10 +661,10 @@ input_curl_easy_init(struct input_stream *is)
curl_easy_setopt(c->easy, CURLOPT_FAILONERROR, true);
curl_easy_setopt(c->easy, CURLOPT_ERRORBUFFER, c->error);
- proxy_host = getConfigParam(CONF_HTTP_PROXY_HOST);
- proxy_port = getConfigParam(CONF_HTTP_PROXY_PORT);
- proxy_user = getConfigParam(CONF_HTTP_PROXY_USER);
- proxy_pass = getConfigParam(CONF_HTTP_PROXY_PASSWORD);
+ proxy_host = config_get_param(CONF_HTTP_PROXY_HOST);
+ proxy_port = config_get_param(CONF_HTTP_PROXY_PORT);
+ proxy_user = config_get_param(CONF_HTTP_PROXY_USER);
+ proxy_pass = config_get_param(CONF_HTTP_PROXY_PASSWORD);
if (proxy_host != NULL) {
char *proxy_host_str;
diff --git a/src/listen.c b/src/listen.c
index fe728be43..eac166330 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -127,7 +127,8 @@ static bool ipv6Supported(void)
#endif
static void
-parseListenConfigParam(G_GNUC_UNUSED unsigned int port, ConfigParam * param)
+parseListenConfigParam(G_GNUC_UNUSED unsigned int port,
+ struct config_param *param)
{
const struct sockaddr *addrp;
socklen_t addrlen;
@@ -253,8 +254,9 @@ parseListenConfigParam(G_GNUC_UNUSED unsigned int port, ConfigParam * param)
void listenOnPort(void)
{
int port = DEFAULT_PORT;
- ConfigParam *param = getNextConfigParam(CONF_BIND_TO_ADDRESS, NULL);
- ConfigParam *portParam = getConfigParam(CONF_PORT);
+ struct config_param *param =
+ config_get_next_param(CONF_BIND_TO_ADDRESS, NULL);
+ struct config_param *portParam = config_get_param(CONF_PORT);
if (portParam) {
char *test;
@@ -271,7 +273,7 @@ void listenOnPort(void)
do {
parseListenConfigParam(port, param);
- } while ((param = getNextConfigParam(CONF_BIND_TO_ADDRESS, param)));
+ } while ((param = config_get_next_param(CONF_BIND_TO_ADDRESS, param)));
}
void closeAllListenSockets(void)
diff --git a/src/log.c b/src/log.c
index 73f2cb3ce..5b878ff4f 100644
--- a/src/log.c
+++ b/src/log.c
@@ -219,19 +219,19 @@ parse_log_level(const char *value, unsigned line)
void log_init(bool verbose, bool use_stdout)
{
- ConfigParam *param;
+ struct config_param *param;
g_get_charset(&log_charset);
if (verbose)
log_threshold = G_LOG_LEVEL_DEBUG;
- else if ((param = getConfigParam(CONF_LOG_LEVEL)) != NULL)
+ else if ((param = config_get_param(CONF_LOG_LEVEL)) != NULL)
log_threshold = parse_log_level(param->value, param->line);
if (use_stdout) {
log_init_stdout();
} else {
- param = getConfigParam(CONF_LOG_FILE);
+ param = config_get_param(CONF_LOG_FILE);
if (param == NULL) {
#ifdef HAVE_SYSLOG
/* no configuration: default to syslog (if
diff --git a/src/main.c b/src/main.c
index 03e81366c..314478d81 100644
--- a/src/main.c
+++ b/src/main.c
@@ -84,7 +84,7 @@ struct notify main_notify;
static void changeToUser(void)
{
#ifndef WIN32
- ConfigParam *param = getConfigParam(CONF_USER);
+ struct config_param *param = config_get_param(CONF_USER);
if (param && strlen(param->value)) {
/* get uid */
@@ -150,7 +150,8 @@ static void openDB(Options * options, char *argv0)
static void cleanUpPidFile(void)
{
- ConfigParam *pidFileParam = parseConfigFilePath(CONF_PID_FILE, 0);
+ struct config_param *pidFileParam =
+ parseConfigFilePath(CONF_PID_FILE, 0);
if (!pidFileParam)
return;
@@ -164,7 +165,8 @@ static void killFromPidFile(void)
{
#ifndef WIN32
FILE *fp;
- ConfigParam *pidFileParam = parseConfigFilePath(CONF_PID_FILE, 0);
+ struct config_param *pidFileParam =
+ parseConfigFilePath(CONF_PID_FILE, 0);
int pid;
if (!pidFileParam) {
@@ -234,7 +236,7 @@ int main(int argc, char *argv[])
dirvec_init();
songvec_init();
tag_pool_init();
- initConf();
+ config_global_init();
parseOptions(argc, argv, &options);
@@ -343,7 +345,7 @@ int main(int argc, char *argv[])
#endif
music_pipe_free();
cleanUpPidFile();
- finishConf();
+ config_global_finish();
tag_pool_deinit();
songvec_deinit();
dirvec_deinit();
diff --git a/src/mapper.c b/src/mapper.c
index 642822c3f..028d35b22 100644
--- a/src/mapper.c
+++ b/src/mapper.c
@@ -43,8 +43,10 @@ static size_t playlist_dir_length;
void mapper_init(void)
{
- ConfigParam *music_dir_param = parseConfigFilePath(CONF_MUSIC_DIR, false);
- ConfigParam *playlist_dir_param = parseConfigFilePath(CONF_PLAYLIST_DIR, 1);
+ struct config_param *music_dir_param =
+ parseConfigFilePath(CONF_MUSIC_DIR, false);
+ struct config_param *playlist_dir_param =
+ parseConfigFilePath(CONF_PLAYLIST_DIR, 1);
int ret;
struct stat st;
diff --git a/src/mixer/alsa_mixer.c b/src/mixer/alsa_mixer.c
index 201cb6f20..2433d5b9c 100644
--- a/src/mixer/alsa_mixer.c
+++ b/src/mixer/alsa_mixer.c
@@ -44,10 +44,10 @@ alsa_mixer_finish(struct mixer_data *data)
}
static void
-alsa_mixer_configure(struct mixer_data *data, ConfigParam *param)
+alsa_mixer_configure(struct mixer_data *data, struct config_param *param)
{
struct alsa_mixer *am = (struct alsa_mixer *)data;
- BlockParam *bp;
+ struct block_param *bp;
if (param == NULL)
return;
@@ -149,7 +149,7 @@ alsa_mixer_control(struct mixer_data *data, int cmd, void *arg)
struct alsa_mixer *am = (struct alsa_mixer *)data;
switch (cmd) {
case AC_MIXER_CONFIGURE:
- alsa_mixer_configure(data, (ConfigParam *)arg);
+ alsa_mixer_configure(data, (struct config_param *)arg);
if (am->handle)
alsa_mixer_close(data);
return true;
diff --git a/src/mixer/oss_mixer.c b/src/mixer/oss_mixer.c
index 3f4b290d9..a6c7684d2 100644
--- a/src/mixer/oss_mixer.c
+++ b/src/mixer/oss_mixer.c
@@ -48,10 +48,10 @@ oss_mixer_finish(struct mixer_data *data)
}
static void
-oss_mixer_configure(struct mixer_data *data, ConfigParam *param)
+oss_mixer_configure(struct mixer_data *data, struct config_param *param)
{
struct oss_mixer *om = (struct oss_mixer *) data;
- BlockParam *bp;
+ struct block_param *bp;
if (param == NULL)
return;
@@ -142,7 +142,7 @@ oss_mixer_control(struct mixer_data *data, int cmd, void *arg)
struct oss_mixer *om = (struct oss_mixer *) data;
switch (cmd) {
case AC_MIXER_CONFIGURE:
- oss_mixer_configure(data, (ConfigParam *)arg);
+ oss_mixer_configure(data, (struct config_param *)arg);
if (om->device_fd >= 0)
oss_mixer_close(data);
return true;
diff --git a/src/mixer_api.c b/src/mixer_api.c
index f77f764cf..cb493aa0a 100644
--- a/src/mixer_api.c
+++ b/src/mixer_api.c
@@ -20,7 +20,7 @@ void mixer_finish(struct mixer *mixer)
mixer->plugin = NULL;
}
-void mixer_configure(struct mixer *mixer, ConfigParam *param)
+void mixer_configure(struct mixer *mixer, struct config_param *param)
{
assert(mixer != NULL && mixer->plugin != NULL);
mixer->plugin->configure(mixer->data, param);
diff --git a/src/mixer_api.h b/src/mixer_api.h
index 67d08427c..61f6c06f2 100644
--- a/src/mixer_api.h
+++ b/src/mixer_api.h
@@ -28,7 +28,7 @@ struct mixer_plugin {
/**
* Setup and configure mixer
*/
- void (*configure)(struct mixer_data *data, ConfigParam *param);
+ void (*configure)(struct mixer_data *data, struct config_param *param);
/**
* Open mixer device
@@ -53,7 +53,7 @@ struct mixer {
void mixer_init(struct mixer *mixer, struct mixer_plugin *plugin);
void mixer_finish(struct mixer *mixer);
-void mixer_configure(struct mixer *mixer, ConfigParam *param);
+void mixer_configure(struct mixer *mixer, struct config_param *param);
bool mixer_open(struct mixer *mixer);
bool mixer_control(struct mixer *mixer, int cmd, void *arg);
void mixer_close(struct mixer *mixer);
diff --git a/src/output/alsa_plugin.c b/src/output/alsa_plugin.c
index 58f549800..0645b34b4 100644
--- a/src/output/alsa_plugin.c
+++ b/src/output/alsa_plugin.c
@@ -88,9 +88,9 @@ static void freeAlsaData(AlsaData * ad)
}
static void
-alsa_configure(AlsaData *ad, ConfigParam *param)
+alsa_configure(AlsaData *ad, struct config_param *param)
{
- BlockParam *bp;
+ struct block_param *bp;
if ((bp = getBlockParam(param, "device")))
ad->device = g_strdup(bp->value);
@@ -119,9 +119,10 @@ alsa_configure(AlsaData *ad, ConfigParam *param)
#endif
}
-static void *alsa_initDriver(G_GNUC_UNUSED struct audio_output *ao,
- G_GNUC_UNUSED const struct audio_format *audio_format,
- ConfigParam * param)
+static void *
+alsa_initDriver(G_GNUC_UNUSED struct audio_output *ao,
+ G_GNUC_UNUSED const struct audio_format *audio_format,
+ struct config_param *param)
{
/* no need for pthread_once thread-safety when reading config */
static int free_global_registered;
diff --git a/src/output/ao_plugin.c b/src/output/ao_plugin.c
index fcbc52dc4..269620143 100644
--- a/src/output/ao_plugin.c
+++ b/src/output/ao_plugin.c
@@ -74,14 +74,15 @@ static void audioOutputAo_error(const char *msg)
g_warning("%s: %s\n", msg, error);
}
-static void *audioOutputAo_initDriver(struct audio_output *ao,
- G_GNUC_UNUSED const struct audio_format *audio_format,
- ConfigParam * param)
+static void *
+audioOutputAo_initDriver(struct audio_output *ao,
+ G_GNUC_UNUSED const struct audio_format *audio_format,
+ struct config_param *param)
{
ao_info *ai;
char *test;
AoData *ad = newAoData();
- BlockParam *blockParam;
+ struct block_param *blockParam;
if ((blockParam = getBlockParam(param, "write_size"))) {
ad->writeSize = strtol(blockParam->value, &test, 10);
diff --git a/src/output/fifo_plugin.c b/src/output/fifo_plugin.c
index efadc8ff6..01db714cf 100644
--- a/src/output/fifo_plugin.c
+++ b/src/output/fifo_plugin.c
@@ -161,10 +161,10 @@ static bool openFifo(FifoData *fd)
static void *fifo_initDriver(G_GNUC_UNUSED struct audio_output *ao,
G_GNUC_UNUSED const struct audio_format *audio_format,
- ConfigParam *param)
+ struct config_param *param)
{
FifoData *fd;
- BlockParam *blockParam;
+ struct block_param *blockParam;
char *path;
blockParam = getBlockParam(param, "path");
diff --git a/src/output/jack_plugin.c b/src/output/jack_plugin.c
index 1aff7d5a1..b65ac97ee 100644
--- a/src/output/jack_plugin.c
+++ b/src/output/jack_plugin.c
@@ -186,10 +186,10 @@ mpd_jack_error(const char *msg)
static void *
mpd_jack_init(struct audio_output *ao,
G_GNUC_UNUSED const struct audio_format *audio_format,
- ConfigParam *param)
+ struct config_param *param)
{
struct jack_data *jd;
- BlockParam *bp;
+ struct block_param *bp;
char *endptr;
int val;
char *cp = NULL;
diff --git a/src/output/mvp_plugin.c b/src/output/mvp_plugin.c
index f4ca64c9f..cc3d53ae2 100644
--- a/src/output/mvp_plugin.c
+++ b/src/output/mvp_plugin.c
@@ -112,7 +112,7 @@ static bool mvp_testDefault(void)
static void *mvp_initDriver(G_GNUC_UNUSED struct audio_output *audio_output,
G_GNUC_UNUSED const struct audio_format *audio_format,
- G_GNUC_UNUSED ConfigParam *param)
+ G_GNUC_UNUSED struct config_param *param)
{
MvpData *md = g_new(MvpData, 1);
md->audio_output = audio_output;
diff --git a/src/output/null_plugin.c b/src/output/null_plugin.c
index d821d6aee..077764308 100644
--- a/src/output/null_plugin.c
+++ b/src/output/null_plugin.c
@@ -28,7 +28,7 @@ struct null_data {
static void *
null_initDriver(G_GNUC_UNUSED struct audio_output *audioOutput,
G_GNUC_UNUSED const struct audio_format *audio_format,
- G_GNUC_UNUSED ConfigParam *param)
+ G_GNUC_UNUSED struct config_param *param)
{
struct null_data *nd = g_new(struct null_data, 1);
nd->timer = NULL;
diff --git a/src/output/oss_plugin.c b/src/output/oss_plugin.c
index cdab24fbd..f66280752 100644
--- a/src/output/oss_plugin.c
+++ b/src/output/oss_plugin.c
@@ -344,7 +344,7 @@ static bool oss_testDefault(void)
return false;
}
-static void *oss_open_default(ConfigParam *param)
+static void *oss_open_default(struct config_param *param)
{
int i;
int err[G_N_ELEMENTS(default_devices)];
@@ -387,12 +387,13 @@ static void *oss_open_default(ConfigParam *param)
return NULL; /* some compilers can be dumb... */
}
-static void *oss_initDriver(G_GNUC_UNUSED struct audio_output *audioOutput,
- G_GNUC_UNUSED const struct audio_format *audio_format,
- ConfigParam * param)
+static void *
+oss_initDriver(G_GNUC_UNUSED struct audio_output *audioOutput,
+ G_GNUC_UNUSED const struct audio_format *audio_format,
+ struct config_param *param)
{
if (param) {
- BlockParam *bp = getBlockParam(param, "device");
+ struct block_param *bp = getBlockParam(param, "device");
if (bp) {
OssData *od = newOssData();
od->device = bp->value;
diff --git a/src/output/osx_plugin.c b/src/output/osx_plugin.c
index ed3e92073..8afd2a934 100644
--- a/src/output/osx_plugin.c
+++ b/src/output/osx_plugin.c
@@ -83,7 +83,7 @@ static bool osx_testDefault(void)
static void *
osx_initDriver(G_GNUC_UNUSED struct audio_output *audioOutput,
G_GNUC_UNUSED const struct audio_format *audio_format,
- G_GNUC_UNUSED ConfigParam * param)
+ G_GNUC_UNUSED struct config_param *param)
{
return newOsxData();
}
diff --git a/src/output/pulse_plugin.c b/src/output/pulse_plugin.c
index e1f6f179b..7d746378c 100644
--- a/src/output/pulse_plugin.c
+++ b/src/output/pulse_plugin.c
@@ -55,10 +55,10 @@ static void pulse_free_data(struct pulse_data *pd)
static void *
pulse_init(struct audio_output *ao,
G_GNUC_UNUSED const struct audio_format *audio_format,
- ConfigParam *param)
+ struct config_param *param)
{
- BlockParam *server = NULL;
- BlockParam *sink = NULL;
+ struct block_param *server = NULL;
+ struct block_param *sink = NULL;
struct pulse_data *pd;
if (param) {
diff --git a/src/output/shout_plugin.c b/src/output/shout_plugin.c
index 06c229e0c..5947f6e20 100644
--- a/src/output/shout_plugin.c
+++ b/src/output/shout_plugin.c
@@ -94,7 +94,7 @@ static void free_shout_data(struct shout_data *sd)
static void *my_shout_init_driver(struct audio_output *audio_output,
const struct audio_format *audio_format,
- ConfigParam *param)
+ struct config_param *param)
{
struct shout_data *sd;
char *test;
@@ -106,7 +106,7 @@ static void *my_shout_init_driver(struct audio_output *audio_output,
unsigned protocol;
const char *user;
char *name;
- BlockParam *block_param;
+ struct block_param *block_param;
int public;
sd = new_shout_data();
diff --git a/src/output_api.h b/src/output_api.h
index fb4b096a1..914eb2ede 100644
--- a/src/output_api.h
+++ b/src/output_api.h
@@ -60,7 +60,7 @@ struct audio_output_plugin {
*/
void *(*init)(struct audio_output *ao,
const struct audio_format *audio_format,
- ConfigParam *param);
+ struct config_param *param);
/**
* Free resources allocated by this device.
diff --git a/src/output_control.h b/src/output_control.h
index 899c763ae..d2fa1e2fa 100644
--- a/src/output_control.h
+++ b/src/output_control.h
@@ -29,7 +29,8 @@ struct audio_output_plugin;
struct audio_format;
struct tag;
-int audio_output_init(struct audio_output *, ConfigParam * param);
+int
+audio_output_init(struct audio_output *, struct config_param *param);
bool
audio_output_open(struct audio_output *audioOutput,
diff --git a/src/output_init.c b/src/output_init.c
index bf92cc852..a0c75a5da 100644
--- a/src/output_init.c
+++ b/src/output_init.c
@@ -38,11 +38,12 @@
if(bp) str = bp->value; \
}
-int audio_output_init(struct audio_output *ao, ConfigParam * param)
+int
+audio_output_init(struct audio_output *ao, struct config_param *param)
{
const char *name = NULL;
char *format = NULL;
- BlockParam *bp = NULL;
+ struct block_param *bp = NULL;
const struct audio_output_plugin *plugin = NULL;
if (param) {
diff --git a/src/path.c b/src/path.c
index 7ff5c7977..3b9b1eff6 100644
--- a/src/path.c
+++ b/src/path.c
@@ -66,7 +66,8 @@ const char *path_get_fs_charset(void)
void path_global_init(void)
{
- ConfigParam *fs_charset_param = getConfigParam(CONF_FS_CHARSET);
+ struct config_param *fs_charset_param =
+ config_get_param(CONF_FS_CHARSET);
const char *charset = NULL;
if (fs_charset_param) {
diff --git a/src/permission.c b/src/permission.c
index b30f5bbc6..a04a12778 100644
--- a/src/permission.c
+++ b/src/permission.c
@@ -71,7 +71,7 @@ void initPermissions(void)
{
char *password;
unsigned permission;
- ConfigParam *param;
+ struct config_param *param;
permission_passwords = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, NULL);
@@ -79,7 +79,7 @@ void initPermissions(void)
permission_default = PERMISSION_READ | PERMISSION_ADD |
PERMISSION_CONTROL | PERMISSION_ADMIN;
- param = getNextConfigParam(CONF_PASSWORD, NULL);
+ param = config_get_next_param(CONF_PASSWORD, NULL);
if (param) {
permission_default = 0;
@@ -102,10 +102,10 @@ void initPermissions(void)
g_hash_table_replace(permission_passwords,
password,
GINT_TO_POINTER(permission));
- } while ((param = getNextConfigParam(CONF_PASSWORD, param)));
+ } while ((param = config_get_next_param(CONF_PASSWORD, param)));
}
- param = getConfigParam(CONF_DEFAULT_PERMS);
+ param = config_get_param(CONF_DEFAULT_PERMS);
if (param)
permission_default = parsePermissions(param->value);
diff --git a/src/playerData.c b/src/playerData.c
index 2731e916b..a2e12562d 100644
--- a/src/playerData.c
+++ b/src/playerData.c
@@ -34,9 +34,9 @@ void initPlayerData(void)
float perc = DEFAULT_BUFFER_BEFORE_PLAY;
char *test;
size_t bufferSize = DEFAULT_BUFFER_SIZE;
- ConfigParam *param;
+ struct config_param *param;
- param = getConfigParam(CONF_AUDIO_BUFFER_SIZE);
+ param = config_get_param(CONF_AUDIO_BUFFER_SIZE);
if (param) {
bufferSize = strtol(param->value, &test, 10);
@@ -54,7 +54,7 @@ void initPlayerData(void)
FATAL("buffer size \"%li\" is too big\n", (long)bufferSize);
}
- param = getConfigParam(CONF_BUFFER_BEFORE_PLAY);
+ param = config_get_param(CONF_BUFFER_BEFORE_PLAY);
if (param) {
perc = strtod(param->value, &test);
diff --git a/src/playlist.c b/src/playlist.c
index 183676854..4d4e0102d 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -120,7 +120,7 @@ static void incrPlaylistCurrent(void)
void initPlaylist(void)
{
char *test;
- ConfigParam *param;
+ struct config_param *param;
int value;
g_rand = g_rand_new();
@@ -132,7 +132,7 @@ void initPlaylist(void)
playlist.queued = -1;
playlist.current = -1;
- param = getConfigParam(CONF_MAX_PLAYLIST_LENGTH);
+ param = config_get_param(CONF_MAX_PLAYLIST_LENGTH);
if (param) {
playlist_max_length = strtol(param->value, &test, 10);
diff --git a/src/replay_gain.c b/src/replay_gain.c
index cc2397b08..9fcfaf9a9 100644
--- a/src/replay_gain.c
+++ b/src/replay_gain.c
@@ -38,7 +38,7 @@ static float replay_gain_preamp = 1.0;
void replay_gain_global_init(void)
{
- ConfigParam *param = getConfigParam(CONF_REPLAYGAIN);
+ struct config_param *param = config_get_param(CONF_REPLAYGAIN);
if (!param)
return;
@@ -52,7 +52,7 @@ void replay_gain_global_init(void)
param->value, param->line);
}
- param = getConfigParam(CONF_REPLAYGAIN_PREAMP);
+ param = config_get_param(CONF_REPLAYGAIN_PREAMP);
if (param) {
char *test;
diff --git a/src/state_file.c b/src/state_file.c
index e45b6ea94..3f4bfaa44 100644
--- a/src/state_file.c
+++ b/src/state_file.c
@@ -43,7 +43,7 @@ static const char *sfpath;
static void get_state_file_path(void)
{
- ConfigParam *param;
+ struct config_param *param;
if (sfpath)
return;
param = parseConfigFilePath(CONF_STATE_FILE, 0);
diff --git a/src/tag.c b/src/tag.c
index edef3aedd..23d786ec2 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -69,7 +69,7 @@ void tag_lib_init(void)
char *temp;
char *s;
char *c;
- ConfigParam *param;
+ struct config_param *param;
int i;
/* parse the "metadata_to_use" config parameter below */
@@ -77,7 +77,7 @@ void tag_lib_init(void)
memset(ignoreTagItems, 0, TAG_NUM_OF_ITEM_TYPES);
ignoreTagItems[TAG_ITEM_COMMENT] = 1; /* ignore comments by default */
- param = getConfigParam(CONF_METADATA_TO_USE);
+ param = config_get_param(CONF_METADATA_TO_USE);
if (!param)
return;
diff --git a/src/utils.c b/src/utils.c
index ca0301e1d..a2f112e72 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -65,7 +65,7 @@ char *parsePath(char *path)
const char *home;
if (path[1] == '/' || path[1] == '\0') {
- ConfigParam *param = getConfigParam(CONF_USER);
+ struct config_param *param = config_get_param(CONF_USER);
if (param && param->value) {
struct passwd *passwd = getpwnam(param->value);
if (!passwd) {
diff --git a/src/volume.c b/src/volume.c
index 5eb0bd64c..3f9a9f1d3 100644
--- a/src/volume.c
+++ b/src/volume.c
@@ -50,22 +50,22 @@ void volume_finish(void)
static void
mixer_reconfigure(char *driver)
{
- ConfigParam *newparam, *param;
+ struct config_param *newparam, *param;
//create parameter list
newparam = newConfigParam(NULL, -1);
- param = getConfigParam(CONF_MIXER_DEVICE);
+ param = config_get_param(CONF_MIXER_DEVICE);
if (param) {
g_warning("deprecated option mixer_device found, translating to %s config section\n", driver);
addBlockParam(newparam, "mixer_device", param->value, -1);
}
- param = getConfigParam(CONF_MIXER_CONTROL);
+ param = config_get_param(CONF_MIXER_CONTROL);
if (param) {
g_warning("deprecated option mixer_control found, translating to %s config section\n", driver);
addBlockParam(newparam, "mixer_control", param->value, -1);
}
- if (newparam->numberOfBlockParams > 0) {
+ if (newparam->num_block_params > 0) {
//call configure method of corrensponding mixer
if (!mixer_configure_legacy(driver, newparam)) {
g_error("Using mixer_type '%s' with not enabled %s output", driver, driver);
@@ -77,7 +77,7 @@ mixer_reconfigure(char *driver)
void volume_init(void)
{
- ConfigParam *param = getConfigParam(CONF_MIXER_TYPE);
+ struct config_param *param = config_get_param(CONF_MIXER_TYPE);
//hw mixing is by default
if (param) {
if (strcmp(param->value, VOLUME_MIXER_SOFTWARE) == 0) {
diff --git a/src/zeroconf.c b/src/zeroconf.c
index dd9790ae3..f2945c4cc 100644
--- a/src/zeroconf.c
+++ b/src/zeroconf.c
@@ -35,7 +35,7 @@ static int zeroconfEnabled;
void initZeroconf(void)
{
const char *serviceName = SERVICE_NAME;
- ConfigParam *param;
+ struct config_param *param;
zeroconfEnabled = getBoolConfigParam(CONF_ZEROCONF_ENABLED, 1);
if (zeroconfEnabled == CONF_BOOL_UNSET)
@@ -44,7 +44,7 @@ void initZeroconf(void)
if (!zeroconfEnabled)
return;
- param = getConfigParam(CONF_ZEROCONF_NAME);
+ param = config_get_param(CONF_ZEROCONF_NAME);
if (param && *param->value != 0)
serviceName = param->value;