output_init: merge two local string variables

This commit is contained in:
Max Kellermann 2009-07-06 21:50:13 +02:00
parent f5c2acf1d4
commit 13e725ab09
1 changed files with 9 additions and 11 deletions

View File

@ -81,21 +81,19 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
const struct audio_output_plugin *plugin = NULL;
if (param) {
const char *type = NULL;
const char *format;
const char *p;
type = config_get_block_string(param, AUDIO_OUTPUT_TYPE, NULL);
if (type == NULL) {
p = config_get_block_string(param, AUDIO_OUTPUT_TYPE, NULL);
if (p == NULL) {
g_set_error(error, audio_output_quark(), 0,
"Missing \"type\" configuration");
return false;
}
plugin = audio_output_plugin_get(type);
plugin = audio_output_plugin_get(p);
if (plugin == NULL) {
g_set_error(error, audio_output_quark(), 0,
"No such audio output plugin: %s",
type);
"No such audio output plugin: %s", p);
return false;
}
@ -107,13 +105,13 @@ audio_output_init(struct audio_output *ao, const struct config_param *param,
return false;
}
format = config_get_block_string(param, AUDIO_OUTPUT_FORMAT,
p = config_get_block_string(param, AUDIO_OUTPUT_FORMAT,
NULL);
ao->config_audio_format = format != NULL;
if (format != NULL) {
ao->config_audio_format = p != NULL;
if (p != NULL) {
bool success =
audio_format_parse(&ao->out_audio_format,
format, error);
p, error);
if (!success)
return false;
}