Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a single

call to FATAL().

git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
J. Alexander Treuman
2007-05-26 18:15:54 +00:00
parent dba45a5992
commit bba444524e
21 changed files with 135 additions and 273 deletions

View File

@@ -75,9 +75,8 @@ static int audioOutputAo_initDriver(AudioOutput * audioOutput,
if ((blockParam = getBlockParam(param, "write_size"))) {
ad->writeSize = strtol(blockParam->value, &test, 10);
if (*test != '\0') {
ERROR("\"%s\" is not a valid write size at line %i\n",
FATAL("\"%s\" is not a valid write size at line %i\n",
blockParam->value, blockParam->line);
exit(EXIT_FAILURE);
}
} else
ad->writeSize = 1024;
@@ -92,16 +91,13 @@ static int audioOutputAo_initDriver(AudioOutput * audioOutput,
if (!blockParam || 0 == strcmp(blockParam->value, "default")) {
ad->driverId = ao_default_driver_id();
} else if ((ad->driverId = ao_driver_id(blockParam->value)) < 0) {
ERROR("\"%s\" is not a valid ao driver at line %i\n",
FATAL("\"%s\" is not a valid ao driver at line %i\n",
blockParam->value, blockParam->line);
exit(EXIT_FAILURE);
}
if ((ai = ao_driver_info(ad->driverId)) == NULL) {
ERROR("problems getting driver info for device defined at "
"line %i\n", param->line);
ERROR("you may not have permission to the audio device\n");
exit(EXIT_FAILURE);
FATAL("problems getting driver info for device defined at line %i\n"
"you may not have permission to the audio device\n" param->line);
}
DEBUG("using ao driver \"%s\" for \"%s\"\n", ai->short_name,
@@ -120,11 +116,8 @@ static int audioOutputAo_initDriver(AudioOutput * audioOutput,
while (n1) {
stk2 = NULL;
key = strtok_r(n1, "=", &stk2);
if (!key) {
ERROR("problems parsing "
"options \"%s\"\n", n1);
exit(EXIT_FAILURE);
}
if (!key)
FATAL("problems parsing options \"%s\"\n", n1);
/*found = 0;
for(i=0;i<ai->option_count;i++) {
if(strcmp(ai->options[i],key)==0) {
@@ -133,17 +126,13 @@ static int audioOutputAo_initDriver(AudioOutput * audioOutput,
}
}
if(!found) {
ERROR("\"%s\" is not an option for "
FATAL("\"%s\" is not an option for "
"\"%s\" ao driver\n",key,
ai->short_name);
exit(EXIT_FAILURE);
} */
value = strtok_r(NULL, "", &stk2);
if (!value) {
ERROR("problems parsing "
"options \"%s\"\n", n1);
exit(EXIT_FAILURE);
}
if (!value)
FATAL("problems parsing options \"%s\"\n", n1);
ao_append_option(&ad->options, key, value);
n1 = strtok_r(NULL, ";", &stk1);
}

View File

@@ -359,7 +359,7 @@ static int oss_open_default(AudioOutput *ao, ConfigParam *param, OssData *od)
}
if (param)
ERROR("Error trying to open specified OSS device"
ERROR("error trying to open specified OSS device"
" at line %i\n", param->line);
else
ERROR("error trying to open default OSS device\n");

View File

@@ -100,10 +100,9 @@ static void freeShoutData(ShoutData * sd)
#define checkBlockParam(name) { \
blockParam = getBlockParam(param, name); \
if(!blockParam) { \
ERROR("no \"%s\" defined for shout device defined at line " \
if (!blockParam) { \
FATAL("no \"%s\" defined for shout device defined at line " \
"%i\n", name, param->line); \
exit(EXIT_FAILURE); \
} \
}
@@ -138,9 +137,8 @@ static int myShout_initDriver(AudioOutput * audioOutput, ConfigParam * param)
port = strtol(blockParam->value, &test, 10);
if (*test != '\0' || port <= 0) {
ERROR("shout port \"%s\" is not a positive integer, line %i\n",
FATAL("shout port \"%s\" is not a positive integer, line %i\n",
blockParam->value, blockParam->line);
exit(EXIT_FAILURE);
}
checkBlockParam("password");
@@ -151,14 +149,13 @@ static int myShout_initDriver(AudioOutput * audioOutput, ConfigParam * param)
blockParam = getBlockParam(param, "public");
if (blockParam) {
if (0 == strcmp(blockParam->value, "yes"))
if (0 == strcmp(blockParam->value, "yes")) {
public = 1;
else if (0 == strcmp(blockParam->value, "no"))
} else if (0 == strcmp(blockParam->value, "no")) {
public = 0;
else {
ERROR("public \"%s\" is not \"yes\" or \"no\" at line "
} else {
FATAL("public \"%s\" is not \"yes\" or \"no\" at line "
"%i\n", param->value, param->line);
exit(EXIT_FAILURE);
}
} else
public = 0;
@@ -177,35 +174,31 @@ static int myShout_initDriver(AudioOutput * audioOutput, ConfigParam * param)
sd->quality = strtod(blockParam->value, &test);
if (*test != '\0' || sd->quality < -1.0 || sd->quality > 10.0) {
ERROR("shout quality \"%s\" is not a number in the "
FATAL("shout quality \"%s\" is not a number in the "
"range -1 to 10, line %i\n", blockParam->value,
blockParam->line);
exit(EXIT_FAILURE);
}
blockParam = getBlockParam(param, "bitrate");
if (blockParam) {
ERROR("quality (line %i) and bitrate (line %i) are "
FATAL("quality (line %i) and bitrate (line %i) are "
"both defined for shout output\n", line,
blockParam->line);
exit(EXIT_FAILURE);
}
} else {
blockParam = getBlockParam(param, "bitrate");
if (!blockParam) {
ERROR("neither bitrate nor quality defined for shout "
FATAL("neither bitrate nor quality defined for shout "
"output at line %i\n", param->line);
exit(EXIT_FAILURE);
}
sd->bitrate = strtol(blockParam->value, &test, 10);
if (*test != '\0' || sd->bitrate <= 0) {
ERROR("bitrate at line %i should be a positive integer "
FATAL("bitrate at line %i should be a positive integer "
"\n", blockParam->line);
exit(EXIT_FAILURE);
}
}
@@ -225,25 +218,22 @@ static int myShout_initDriver(AudioOutput * audioOutput, ConfigParam * param)
shout_set_protocol(sd->shoutConn, SHOUT_PROTOCOL_HTTP)
!= SHOUTERR_SUCCESS ||
shout_set_agent(sd->shoutConn, "MPD") != SHOUTERR_SUCCESS) {
ERROR("error configuring shout defined at line %i: %s\n",
FATAL("error configuring shout defined at line %i: %s\n",
param->line, shout_get_error(sd->shoutConn));
exit(EXIT_FAILURE);
}
/* optional paramters */
blockParam = getBlockParam(param, "genre");
if (blockParam && shout_set_genre(sd->shoutConn, blockParam->value)) {
ERROR("error configuring shout defined at line %i: %s\n",
FATAL("error configuring shout defined at line %i: %s\n",
param->line, shout_get_error(sd->shoutConn));
exit(EXIT_FAILURE);
}
blockParam = getBlockParam(param, "description");
if (blockParam && shout_set_description(sd->shoutConn,
blockParam->value)) {
ERROR("error configuring shout defined at line %i: %s\n",
FATAL("error configuring shout defined at line %i: %s\n",
param->line, shout_get_error(sd->shoutConn));
exit(EXIT_FAILURE);
}
{