]> Shamusworld >> Repos - apple2/blobdiff - src/log.cpp
Added floppy #2 saving, statistics to makefile.
[apple2] / src / log.cpp
old mode 100755 (executable)
new mode 100644 (file)
index e56a557..6994cc5
@@ -1,10 +1,10 @@
 //
 // Log handler
 //
-// by James L. Hammons
+// by James Hammons
 // (C) 2006 Underground Software
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
@@ -23,7 +23,6 @@
 
 static FILE * log_stream = NULL;
 static uint32_t logSize = 0;
-static bool logDone = false;
 
 
 bool InitLog(const char * path)
@@ -50,22 +49,21 @@ void LogDone(void)
 //
 void WriteLog(const char * text, ...)
 {
-       if (!log_stream || logDone)
+       if (!log_stream)
                return;
 
        va_list arg;
 
        va_start(arg, text);
        logSize += vfprintf(log_stream, text, arg);
+       va_end(arg);
+
+       fflush(log_stream);                                     // Make sure that text is written!
 
        if (logSize > MAX_LOG_SIZE)
        {
-               fflush(log_stream);
                fclose(log_stream);
-               logDone = true;
+               log_stream = NULL;
        }
-
-       va_end(arg);
-       fflush(log_stream);                                     // Make sure that text is written!
 }