[CMD] Improve performance a bit

Do not use custom alloc/free functions by default.
Do not free resources at process exit.
 - You're doing it brick by brick while the OS  & CRT do that with a bulldozer better than you do.
This commit is contained in:
Jérôme Gardou 2021-06-22 12:44:56 +02:00 committed by Jérôme Gardou
parent 4130f0b1c5
commit 5ca83e516c
2 changed files with 12 additions and 11 deletions

View file

@ -1,6 +1,4 @@
add_definitions(-D_DEBUG_MEM)
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
include_directories(${REACTOS_SOURCE_DIR}/sdk/lib/conutils)

View file

@ -2333,6 +2333,17 @@ static VOID Cleanup(VOID)
ParseCommandLine(_T("\\cmdexit.bat"));
}
/* Remove ctrl break handler */
RemoveBreakHandler();
/* Restore the default console mode */
SetConsoleMode(ConStreamGetOSHandle(StdIn),
ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
SetConsoleMode(ConStreamGetOSHandle(StdOut),
ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
#ifdef _DEBUG_MEM
#ifdef FEATURE_DIRECTORY_STACK
/* Destroy directory stack */
DestroyDirectoryStack();
@ -2344,15 +2355,7 @@ static VOID Cleanup(VOID)
/* Free GetEnvVar's buffer */
GetEnvVar(NULL);
/* Remove ctrl break handler */
RemoveBreakHandler();
/* Restore the default console mode */
SetConsoleMode(ConStreamGetOSHandle(StdIn),
ENABLE_PROCESSED_INPUT | ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
SetConsoleMode(ConStreamGetOSHandle(StdOut),
ENABLE_PROCESSED_OUTPUT | ENABLE_WRAP_AT_EOL_OUTPUT);
#endif /* _DEBUG_MEM */
DeleteCriticalSection(&ChildProcessRunningLock);
}