little optimization from PM

This commit is contained in:
Borja Ferrer 2006-03-19 20:39:25 +00:00
parent b5e8bc9ec1
commit d84ef62e6c

View File

@ -97,8 +97,8 @@ void CLog::CreateNewFile()
while (true) while (true)
{ {
m_LogFile.assign(build_pathname_r(file, sizeof(file)-1, "%s/L%02d%02d%03d.log", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday, i)); build_pathname_r(file, sizeof(file)-1, "%s/L%02d%02d%03d.log", g_log_dir.c_str(), curTime->tm_mon + 1, curTime->tm_mday, i);
FILE *pTmpFile = fopen(m_LogFile.c_str(), "r"); // open for reading to check whether the file exists FILE *pTmpFile = fopen(file, "r"); // open for reading to check whether the file exists
if (!pTmpFile) if (!pTmpFile)
break; break;
@ -106,6 +106,7 @@ void CLog::CreateNewFile()
fclose(pTmpFile); fclose(pTmpFile);
++i; ++i;
} }
m_LogFile.assign(file);
// Log logfile start // Log logfile start
FILE *fp = fopen(m_LogFile.c_str(), "w"); FILE *fp = fopen(m_LogFile.c_str(), "w");