Add mpd-indent.sh
Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
49
src/log.c
49
src/log.c
@@ -29,36 +29,39 @@
|
||||
int logLevel = LOG_LEVEL_LOW;
|
||||
short warningFlushed = 0;
|
||||
|
||||
static char * warningBuffer = NULL;
|
||||
static char *warningBuffer = NULL;
|
||||
|
||||
void initLog(void) {
|
||||
ConfigParam * param = getConfigParam(CONF_LOG_LEVEL);
|
||||
void initLog(void)
|
||||
{
|
||||
ConfigParam *param = getConfigParam(CONF_LOG_LEVEL);
|
||||
|
||||
if(!param) return;
|
||||
if (!param)
|
||||
return;
|
||||
|
||||
if(0 == strcmp(param->value, "default")) {
|
||||
if(logLevel<LOG_LEVEL_LOW) logLevel = LOG_LEVEL_LOW;
|
||||
}
|
||||
else if(0 == strcmp(param->value, "secure")) {
|
||||
if(logLevel<LOG_LEVEL_SECURE) logLevel = LOG_LEVEL_SECURE;
|
||||
}
|
||||
else if(0 == strcmp(param->value, "verbose")) {
|
||||
if(logLevel<LOG_LEVEL_DEBUG) logLevel = LOG_LEVEL_DEBUG;
|
||||
}
|
||||
else {
|
||||
if (0 == strcmp(param->value, "default")) {
|
||||
if (logLevel < LOG_LEVEL_LOW)
|
||||
logLevel = LOG_LEVEL_LOW;
|
||||
} else if (0 == strcmp(param->value, "secure")) {
|
||||
if (logLevel < LOG_LEVEL_SECURE)
|
||||
logLevel = LOG_LEVEL_SECURE;
|
||||
} else if (0 == strcmp(param->value, "verbose")) {
|
||||
if (logLevel < LOG_LEVEL_DEBUG)
|
||||
logLevel = LOG_LEVEL_DEBUG;
|
||||
} else {
|
||||
ERROR("unknown log level \"%s\" at line %i\n",
|
||||
param->value, param->line);
|
||||
param->value, param->line);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
#define BUFFER_LENGTH 4096
|
||||
|
||||
void bufferWarning(char * format, ... ) {
|
||||
void bufferWarning(char *format, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
char temp[BUFFER_LENGTH+1];
|
||||
char temp[BUFFER_LENGTH + 1];
|
||||
|
||||
memset(temp, 0, BUFFER_LENGTH+1);
|
||||
memset(temp, 0, BUFFER_LENGTH + 1);
|
||||
|
||||
va_start(arglist, format);
|
||||
|
||||
@@ -69,15 +72,17 @@ void bufferWarning(char * format, ... ) {
|
||||
va_end(arglist);
|
||||
}
|
||||
|
||||
void flushWarningLog(void) {
|
||||
char * s;
|
||||
void flushWarningLog(void)
|
||||
{
|
||||
char *s;
|
||||
|
||||
DEBUG("flushing warning messages\n");
|
||||
|
||||
if(warningBuffer == NULL) return;
|
||||
if (warningBuffer == NULL)
|
||||
return;
|
||||
|
||||
s = strtok(warningBuffer, "\n");
|
||||
while ( s != NULL ) {
|
||||
while (s != NULL) {
|
||||
myfprintf(stderr, "%s\n", s);
|
||||
|
||||
s = strtok(NULL, "\n");
|
||||
|
Reference in New Issue
Block a user