conf: no CamelCase, part I

Renamed functions, types, variables.
This commit is contained in:
Max Kellermann 2009-01-17 20:23:27 +01:00
parent 2bbf378dd8
commit 4d472c265e
40 changed files with 204 additions and 170 deletions

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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");
}

View File

@ -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->blockParams = g_realloc(param->blockParams,
param->numberOfBlockParams *
sizeof(BlockParam));
param->num_block_params++;
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;
param->block_params = g_realloc(param->block_params,
param->num_block_params *
sizeof(param->block_params[0]));
bp = &param->block_params[param->num_block_params - 1];
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;

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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)

View File

@ -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

View File

@ -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();

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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");

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();
}

View File

@ -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) {

View File

@ -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();

View File

@ -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.

View File

@ -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,

View File

@ -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) {

View File

@ -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) {

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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);

View File

@ -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;

View File

@ -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) {

View File

@ -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) {

View File

@ -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;