Francois Gouget : msvcrt: Statically initialize and name the MSVCRT_file_cs critical section.

Alexandre Julliard julliard at winehq.org
Wed Nov 16 12:46:46 CST 2011


Module: wine
Branch: master
Commit: d78bfe1149c1974d29d602a219f4423eaaa4e921
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d78bfe1149c1974d29d602a219f4423eaaa4e921

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Wed Nov 16 16:28:20 2011 +0100

msvcrt: Statically initialize and name the MSVCRT_file_cs critical section.

---

 dlls/msvcrt/file.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 1334ec6..c636e85 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -128,6 +128,13 @@ static const ULONGLONG WCCOM = TOUL('c') << 32 | TOUL('o') << 16 | TOUL('m');
  * protection, rather than locking the whole table for every change.
  */
 static CRITICAL_SECTION MSVCRT_file_cs;
+static CRITICAL_SECTION_DEBUG MSVCRT_file_cs_debug =
+{
+    0, 0, &MSVCRT_file_cs,
+    { &MSVCRT_file_cs_debug.ProcessLocksList, &MSVCRT_file_cs_debug.ProcessLocksList },
+      0, 0, { (DWORD_PTR)(__FILE__ ": MSVCRT_file_cs") }
+};
+static CRITICAL_SECTION MSVCRT_file_cs = { &MSVCRT_file_cs_debug, -1, 0, 0, 0, 0 };
 #define LOCK_FILES()    do { EnterCriticalSection(&MSVCRT_file_cs); } while (0)
 #define UNLOCK_FILES()  do { LeaveCriticalSection(&MSVCRT_file_cs); } while (0)
 
@@ -440,8 +447,6 @@ void msvcrt_init_io(void)
   int           i;
   ioinfo        *fdinfo;
 
-  InitializeCriticalSection(&MSVCRT_file_cs);
-  MSVCRT_file_cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": MSVCRT_file_cs");
   GetStartupInfoA(&si);
   if (si.cbReserved2 >= sizeof(unsigned int) && si.lpReserved2 != NULL)
   {
@@ -983,7 +988,6 @@ void msvcrt_free_io(void)
     for(i=0; i<sizeof(MSVCRT_fstream)/sizeof(MSVCRT_fstream[0]); i++)
         MSVCRT_free(MSVCRT_fstream[i]);
 
-    MSVCRT_file_cs.DebugInfo->Spare[0] = 0;
     DeleteCriticalSection(&MSVCRT_file_cs);
 }
 




More information about the wine-cvs mailing list