diff options
author | Max Kellermann <max@duempel.org> | 2009-01-25 16:03:49 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-01-25 16:03:49 +0100 |
commit | 5f7791009790dc40f2d76be310ffeab55c242ced (patch) | |
tree | 5e26d9d5f873a76fe61c6403a69ae123b0d57ad3 | |
parent | 80799fa84eb4330083e4de20b87f97beea7d6ba7 (diff) | |
download | mpd-5f7791009790dc40f2d76be310ffeab55c242ced.tar.gz mpd-5f7791009790dc40f2d76be310ffeab55c242ced.tar.xz mpd-5f7791009790dc40f2d76be310ffeab55c242ced.zip |
conf: const pointers in block get functions
All config_get_block_*() functions should accept constant config_param
pointers.
-rw-r--r-- | src/audio.c | 6 | ||||
-rw-r--r-- | src/conf.c | 16 | ||||
-rw-r--r-- | src/conf.h | 12 | ||||
-rw-r--r-- | src/listen.c | 4 | ||||
-rw-r--r-- | src/log.c | 5 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/mixer/alsa_mixer.c | 4 | ||||
-rw-r--r-- | src/mixer/oss_mixer.c | 4 | ||||
-rw-r--r-- | src/mixer_api.c | 2 | ||||
-rw-r--r-- | src/mixer_api.h | 5 | ||||
-rw-r--r-- | src/output/alsa_plugin.c | 4 | ||||
-rw-r--r-- | src/output/ao_plugin.c | 2 | ||||
-rw-r--r-- | src/output/fifo_plugin.c | 2 | ||||
-rw-r--r-- | src/output/jack_plugin.c | 2 | ||||
-rw-r--r-- | src/output/mvp_plugin.c | 2 | ||||
-rw-r--r-- | src/output/null_plugin.c | 2 | ||||
-rw-r--r-- | src/output/oss_plugin.c | 4 | ||||
-rw-r--r-- | src/output/osx_plugin.c | 2 | ||||
-rw-r--r-- | src/output/pulse_plugin.c | 2 | ||||
-rw-r--r-- | src/output/shout_plugin.c | 2 | ||||
-rw-r--r-- | src/output_api.h | 2 | ||||
-rw-r--r-- | src/output_control.h | 2 | ||||
-rw-r--r-- | src/output_init.c | 2 | ||||
-rw-r--r-- | src/permission.c | 2 | ||||
-rw-r--r-- | src/replay_gain.c | 2 | ||||
-rw-r--r-- | src/tag.c | 2 | ||||
-rw-r--r-- | src/volume.c | 2 |
27 files changed, 49 insertions, 49 deletions
diff --git a/src/audio.c b/src/audio.c index 78d07a5a9..07f7f17cb 100644 --- a/src/audio.c +++ b/src/audio.c @@ -43,7 +43,7 @@ static unsigned int audioOutputArraySize; unsigned int audio_output_count(void) { unsigned int nr = 0; - struct config_param *param = NULL; + const struct config_param *param = NULL; while ((param = config_get_next_param(CONF_AUDIO_OUTPUT, param))) nr++; @@ -55,7 +55,7 @@ unsigned int audio_output_count(void) /* make sure initPlayerData is called before this function!! */ void initAudioDriver(void) { - struct config_param *param = NULL; + const struct config_param *param = NULL; unsigned int i; notify_init(&audio_output_client_notify); @@ -106,7 +106,7 @@ void getOutputAudioFormat(const struct audio_format *inAudioFormat, void initAudioConfig(void) { - struct config_param *param = config_get_param(CONF_AUDIO_OUTPUT_FORMAT); + const struct config_param *param = config_get_param(CONF_AUDIO_OUTPUT_FORMAT); if (NULL == param || NULL == param->value) return; diff --git a/src/conf.c b/src/conf.c index 74e1f5337..fbb348cf9 100644 --- a/src/conf.c +++ b/src/conf.c @@ -350,7 +350,7 @@ void config_read_file(const char *file) } struct config_param * -config_get_next_param(const char *name, struct config_param * last) +config_get_next_param(const char *name, const struct config_param * last) { struct config_entry *entry; GSList *node; @@ -381,7 +381,7 @@ config_get_next_param(const char *name, struct config_param * last) const char * config_get_string(const char *name, const char *default_value) { - struct config_param *param = config_get_param(name); + const struct config_param *param = config_get_param(name); if (param == NULL) return default_value; @@ -410,7 +410,7 @@ config_get_path(const char *name) unsigned config_get_positive(const char *name, unsigned default_value) { - struct config_param *param = config_get_param(name); + const struct config_param *param = config_get_param(name); long value; char *endptr; @@ -428,7 +428,7 @@ config_get_positive(const char *name, unsigned default_value) } struct block_param * -getBlockParam(struct config_param * param, const char *name) +getBlockParam(const struct config_param * param, const char *name) { struct block_param *ret = NULL; int i; @@ -449,7 +449,7 @@ getBlockParam(struct config_param * param, const char *name) bool config_get_bool(const char *name, bool default_value) { - struct config_param *param = config_get_param(name); + const struct config_param *param = config_get_param(name); int value; if (param == NULL) @@ -468,7 +468,7 @@ bool config_get_bool(const char *name, bool default_value) } const char * -config_get_block_string(struct config_param *param, const char *name, +config_get_block_string(const struct config_param *param, const char *name, const char *default_value) { struct block_param *bp = getBlockParam(param, name); @@ -480,7 +480,7 @@ config_get_block_string(struct config_param *param, const char *name, } unsigned -config_get_block_unsigned(struct config_param *param, const char *name, +config_get_block_unsigned(const struct config_param *param, const char *name, unsigned default_value) { struct block_param *bp = getBlockParam(param, name); @@ -501,7 +501,7 @@ config_get_block_unsigned(struct config_param *param, const char *name, } bool -config_get_block_bool(struct config_param *param, const char *name, +config_get_block_bool(const struct config_param *param, const char *name, bool default_value) { struct block_param *bp = getBlockParam(param, name); diff --git a/src/conf.h b/src/conf.h index a133198bd..42ac6f228 100644 --- a/src/conf.h +++ b/src/conf.h @@ -94,7 +94,7 @@ void config_read_file(const char *file); /* don't free the returned value set _last_ to NULL to get first entry */ struct config_param * -config_get_next_param(const char *name, struct config_param *last); +config_get_next_param(const char *name, const struct config_param *last); static inline struct config_param * config_get_param(const char *name) @@ -117,27 +117,27 @@ unsigned config_get_positive(const char *name, unsigned default_value); struct block_param * -getBlockParam(struct config_param *param, const char *name); +getBlockParam(const struct config_param *param, const char *name); bool config_get_bool(const char *name, bool default_value); const char * -config_get_block_string(struct config_param *param, const char *name, +config_get_block_string(const struct config_param *param, const char *name, const char *default_value); static inline char * -config_dup_block_string(struct config_param *param, const char *name, +config_dup_block_string(const struct config_param *param, const char *name, const char *default_value) { return g_strdup(config_get_block_string(param, name, default_value)); } unsigned -config_get_block_unsigned(struct config_param *param, const char *name, +config_get_block_unsigned(const struct config_param *param, const char *name, unsigned default_value); bool -config_get_block_bool(struct config_param *param, const char *name, +config_get_block_bool(const struct config_param *param, const char *name, bool default_value); struct config_param * diff --git a/src/listen.c b/src/listen.c index a0efbe148..51f6f9f22 100644 --- a/src/listen.c +++ b/src/listen.c @@ -128,7 +128,7 @@ static bool ipv6Supported(void) static void parseListenConfigParam(G_GNUC_UNUSED unsigned int port, - struct config_param *param) + const struct config_param *param) { const struct sockaddr *addrp; socklen_t addrlen; @@ -254,7 +254,7 @@ parseListenConfigParam(G_GNUC_UNUSED unsigned int port, void listenOnPort(void) { int port = config_get_positive(CONF_PORT, DEFAULT_PORT); - struct config_param *param = + const struct config_param *param = config_get_next_param(CONF_BIND_TO_ADDRESS, NULL); do { @@ -219,7 +219,7 @@ parse_log_level(const char *value, unsigned line) void log_init(bool verbose, bool use_stdout) { - struct config_param *param; + const struct config_param *param; g_get_charset(&log_charset); @@ -252,9 +252,8 @@ void log_init(bool verbose, bool use_stdout) if (path == NULL) g_error("error parsing \"%s\" at line %i\n", CONF_LOG_FILE, param->line); - param->value = path; - log_init_file(param->value, param->line); + log_init_file(path, param->line); } } } diff --git a/src/main.c b/src/main.c index 04a8de33e..f82ea596a 100644 --- a/src/main.c +++ b/src/main.c @@ -126,7 +126,7 @@ static void openDB(Options * options, char *argv0) static void initialize_decoder_and_player(void) { - struct config_param *param; + const struct config_param *param; char *test; size_t buffer_size; float perc; diff --git a/src/mixer/alsa_mixer.c b/src/mixer/alsa_mixer.c index 7dafd22cc..d0cfdd5a2 100644 --- a/src/mixer/alsa_mixer.c +++ b/src/mixer/alsa_mixer.c @@ -43,7 +43,7 @@ alsa_mixer_finish(struct mixer_data *data) } static void -alsa_mixer_configure(struct mixer_data *data, struct config_param *param) +alsa_mixer_configure(struct mixer_data *data, const struct config_param *param) { struct alsa_mixer *am = (struct alsa_mixer *)data; const char *value; @@ -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, (struct config_param *)arg); + alsa_mixer_configure(data, (const 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 5e3b65f46..ed370483d 100644 --- a/src/mixer/oss_mixer.c +++ b/src/mixer/oss_mixer.c @@ -47,7 +47,7 @@ oss_mixer_finish(struct mixer_data *data) } static void -oss_mixer_configure(struct mixer_data *data, struct config_param *param) +oss_mixer_configure(struct mixer_data *data, const struct config_param *param) { struct oss_mixer *om = (struct oss_mixer *) data; const char *value; @@ -140,7 +140,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, (struct config_param *)arg); + oss_mixer_configure(data, (const 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 cb493aa0a..51df10d78 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, struct config_param *param) +void mixer_configure(struct mixer *mixer, const 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 61f6c06f2..55aa7684c 100644 --- a/src/mixer_api.h +++ b/src/mixer_api.h @@ -28,7 +28,8 @@ struct mixer_plugin { /** * Setup and configure mixer */ - void (*configure)(struct mixer_data *data, struct config_param *param); + void (*configure)(struct mixer_data *data, + const struct config_param *param); /** * Open mixer device @@ -53,7 +54,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, struct config_param *param); +void mixer_configure(struct mixer *mixer, const 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 3ad502ba2..536d399d1 100644 --- a/src/output/alsa_plugin.c +++ b/src/output/alsa_plugin.c @@ -108,7 +108,7 @@ alsa_data_free(struct alsa_data *ad) } static void -alsa_configure(struct alsa_data *ad, struct config_param *param) +alsa_configure(struct alsa_data *ad, const struct config_param *param) { ad->device = config_dup_block_string(param, "device", NULL); @@ -138,7 +138,7 @@ alsa_configure(struct alsa_data *ad, struct config_param *param) static void * alsa_init(G_GNUC_UNUSED struct audio_output *ao, G_GNUC_UNUSED const struct audio_format *audio_format, - struct config_param *param) + const 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 f24805de0..10ce9c9de 100644 --- a/src/output/ao_plugin.c +++ b/src/output/ao_plugin.c @@ -77,7 +77,7 @@ static void audioOutputAo_error(const char *msg) static void * audioOutputAo_initDriver(struct audio_output *ao, G_GNUC_UNUSED const struct audio_format *audio_format, - struct config_param *param) + const struct config_param *param) { ao_info *ai; AoData *ad = newAoData(); diff --git a/src/output/fifo_plugin.c b/src/output/fifo_plugin.c index 5d1f287b2..b0c6d12f4 100644 --- a/src/output/fifo_plugin.c +++ b/src/output/fifo_plugin.c @@ -161,7 +161,7 @@ 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, - struct config_param *param) + const struct config_param *param) { FifoData *fd; char *value, *path; diff --git a/src/output/jack_plugin.c b/src/output/jack_plugin.c index 185f73860..8d09dd1d9 100644 --- a/src/output/jack_plugin.c +++ b/src/output/jack_plugin.c @@ -183,7 +183,7 @@ mpd_jack_error(const char *msg) static void * mpd_jack_init(struct audio_output *ao, G_GNUC_UNUSED const struct audio_format *audio_format, - struct config_param *param) + const struct config_param *param) { struct jack_data *jd; const char *value; diff --git a/src/output/mvp_plugin.c b/src/output/mvp_plugin.c index cc3d53ae2..cf63faf08 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 struct config_param *param) + G_GNUC_UNUSED const 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 7530a20cc..1ae55ca9b 100644 --- a/src/output/null_plugin.c +++ b/src/output/null_plugin.c @@ -32,7 +32,7 @@ struct null_data { static void * null_init(G_GNUC_UNUSED struct audio_output *audio_output, G_GNUC_UNUSED const struct audio_format *audio_format, - G_GNUC_UNUSED struct config_param *param) + G_GNUC_UNUSED const struct config_param *param) { struct null_data *nd = g_new(struct null_data, 1); diff --git a/src/output/oss_plugin.c b/src/output/oss_plugin.c index e83a05c5a..b27aa1b77 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(struct config_param *param) +static void *oss_open_default(const struct config_param *param) { int i; int err[G_N_ELEMENTS(default_devices)]; @@ -390,7 +390,7 @@ static void *oss_open_default(struct config_param *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) + const struct config_param *param) { if (param) { const char *device = diff --git a/src/output/osx_plugin.c b/src/output/osx_plugin.c index 8afd2a934..44a87f9d3 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 struct config_param *param) + G_GNUC_UNUSED const struct config_param *param) { return newOsxData(); } diff --git a/src/output/pulse_plugin.c b/src/output/pulse_plugin.c index 45710b4a9..559d2ee56 100644 --- a/src/output/pulse_plugin.c +++ b/src/output/pulse_plugin.c @@ -55,7 +55,7 @@ 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, - struct config_param *param) + const struct config_param *param) { struct pulse_data *pd; diff --git a/src/output/shout_plugin.c b/src/output/shout_plugin.c index 7d3e4aaf0..2217bc56e 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, - struct config_param *param) + const struct config_param *param) { struct shout_data *sd; char *test; diff --git a/src/output_api.h b/src/output_api.h index 914eb2ede..b3c13335c 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, - struct config_param *param); + const struct config_param *param); /** * Free resources allocated by this device. diff --git a/src/output_control.h b/src/output_control.h index b84fcf07a..603d2ac00 100644 --- a/src/output_control.h +++ b/src/output_control.h @@ -29,7 +29,7 @@ struct tag; struct config_param; int -audio_output_init(struct audio_output *, struct config_param *param); +audio_output_init(struct audio_output *, const 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 a0c75a5da..6d974bdb8 100644 --- a/src/output_init.c +++ b/src/output_init.c @@ -39,7 +39,7 @@ } int -audio_output_init(struct audio_output *ao, struct config_param *param) +audio_output_init(struct audio_output *ao, const struct config_param *param) { const char *name = NULL; char *format = NULL; diff --git a/src/permission.c b/src/permission.c index a04a12778..689f2907d 100644 --- a/src/permission.c +++ b/src/permission.c @@ -71,7 +71,7 @@ void initPermissions(void) { char *password; unsigned permission; - struct config_param *param; + const struct config_param *param; permission_passwords = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); diff --git a/src/replay_gain.c b/src/replay_gain.c index 9fcfaf9a9..8e787a0ae 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) { - struct config_param *param = config_get_param(CONF_REPLAYGAIN); + const struct config_param *param = config_get_param(CONF_REPLAYGAIN); if (!param) return; @@ -76,7 +76,7 @@ void tag_lib_init(void) char *temp; char *s; char *c; - struct config_param *param; + const struct config_param *param; int i; /* parse the "metadata_to_use" config parameter below */ diff --git a/src/volume.c b/src/volume.c index 3f9a9f1d3..ce6e38dc1 100644 --- a/src/volume.c +++ b/src/volume.c @@ -77,7 +77,7 @@ mixer_reconfigure(char *driver) void volume_init(void) { - struct config_param *param = config_get_param(CONF_MIXER_TYPE); + const 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) { |