aboutsummaryrefslogtreecommitdiffstats
path: root/src/log.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2006-10-03 02:22:37 +0000
committerWarren Dukes <warren.dukes@gmail.com>2006-10-03 02:22:37 +0000
commit347a33b009700a447e723ae83359851d6b4e7e02 (patch)
treeeab6445228d588bdb6c357271ffc315c9ca373a2 /src/log.c
parent648f48ce3b0685260f4c578b5eccd0d1b7471046 (diff)
downloadmpd-347a33b009700a447e723ae83359851d6b4e7e02.tar.gz
mpd-347a33b009700a447e723ae83359851d6b4e7e02.tar.xz
mpd-347a33b009700a447e723ae83359851d6b4e7e02.zip
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
Diffstat (limited to '')
-rw-r--r--src/log.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/log.c b/src/log.c
index a59b331f1..2e6eb3575 100644
--- a/src/log.c
+++ b/src/log.c
@@ -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;
-
- s = strtok(warningBuffer, "\n");
- while (s != NULL) {
- fprintf(stderr, "%s\n", s);
- s = strtok(NULL, "\n");
+ if (warningBuffer != NULL)
+ {
+ while (s != NULL) {
+ char * next = strchr(s, '\n');
+ if (next != NULL) {
+ *next = '\0';
+ next++;
+ }
+ fprintf(stderr, "%s\n", s);
+ s = next;
+ }
+
+ warningBuffer = NULL;
}
- free(warningBuffer);
- warningBuffer = NULL;
warningFlushed = 1;
+
+ DEBUG("done flushing warning messages\n");
}
void initLog(const int verbose)