https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5ca83e516cbb5ab3fd809e...
commit 5ca83e516cbb5ab3fd809e044c0de4c018bd20c3 Author: Jérôme Gardou jerome.gardou@reactos.org AuthorDate: Tue Jun 22 12:44:56 2021 +0200 Commit: Jérôme Gardou zefklop@users.noreply.github.com CommitDate: Thu Jun 24 15:03:36 2021 +0200
[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. --- base/shell/cmd/CMakeLists.txt | 2 -- base/shell/cmd/cmd.c | 21 ++++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/base/shell/cmd/CMakeLists.txt b/base/shell/cmd/CMakeLists.txt index 471ecd0dfe1..b1cf669c03a 100644 --- a/base/shell/cmd/CMakeLists.txt +++ b/base/shell/cmd/CMakeLists.txt @@ -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)
diff --git a/base/shell/cmd/cmd.c b/base/shell/cmd/cmd.c index 99070ff24f9..0f16229172f 100644 --- a/base/shell/cmd/cmd.c +++ b/base/shell/cmd/cmd.c @@ -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); }