cleanup flushWarningBuffer() and make some for() loops in audio.c look and do something sane.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4867 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Warren Dukes
2006-10-03 02:22:37 +00:00
parent 648f48ce3b
commit 347a33b009
2 changed files with 23 additions and 17 deletions

View File

@@ -93,22 +93,28 @@ static void do_log(FILE *fp, const char *fmt, va_list args)
void flushWarningLog(void)
{
char *s;
char *s = warningBuffer;
DEBUG("flushing warning messages\n");
if (warningBuffer == NULL)
return;
if (warningBuffer != NULL)
{
while (s != NULL) {
char * next = strchr(s, '\n');
if (next != NULL) {
*next = '\0';
next++;
}
fprintf(stderr, "%s\n", s);
s = next;
}
s = strtok(warningBuffer, "\n");
while (s != NULL) {
fprintf(stderr, "%s\n", s);
s = strtok(NULL, "\n");
warningBuffer = NULL;
}
free(warningBuffer);
warningBuffer = NULL;
warningFlushed = 1;
DEBUG("done flushing warning messages\n");
}
void initLog(const int verbose)