Juan Lang : crypt32: Statically initialize static lists and critical sections.

Alexandre Julliard julliard at wine.codeweavers.com
Fri May 25 14:43:33 CDT 2007


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

Author: Juan Lang <juan_lang at yahoo.com>
Date:   Thu May 24 16:42:45 2007 -0700

crypt32: Statically initialize static lists and critical sections.

---

 dlls/crypt32/oid.c |   34 ++++++++++++++++------------------
 1 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/dlls/crypt32/oid.c b/dlls/crypt32/oid.c
index 1865f97..4b51a70 100644
--- a/dlls/crypt32/oid.c
+++ b/dlls/crypt32/oid.c
@@ -37,14 +37,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(crypt);
 
 static const WCHAR DllW[] = { 'D','l','l',0 };
 
-static void init_function_sets(void);
 static void init_oid_info(HINSTANCE hinst);
 static void free_function_sets(void);
 static void free_oid_info(void);
 
 void crypt_oid_init(HINSTANCE hinst)
 {
-    init_function_sets();
     init_oid_info(hinst);
 }
 
@@ -55,7 +53,14 @@ void crypt_oid_free(void)
 }
 
 static CRITICAL_SECTION funcSetCS;
-static struct list funcSets;
+static CRITICAL_SECTION_DEBUG funcSetCSDebug =
+{
+    0, 0, &funcSetCS,
+    { &funcSetCSDebug.ProcessLocksList, &funcSetCSDebug.ProcessLocksList },
+    0, 0, { (DWORD_PTR)(__FILE__ ": funcSetCS") }
+};
+static CRITICAL_SECTION funcSetCS = { &funcSetCSDebug, -1, 0, 0, 0, 0 };
+static struct list funcSets = { &funcSets, &funcSets };
 
 struct OIDFunctionSet
 {
@@ -72,13 +77,6 @@ struct OIDFunction
     struct list next;
 };
 
-static void init_function_sets(void)
-{
-    InitializeCriticalSection(&funcSetCS);
-    funcSetCS.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": funcSetCS");
-    list_init(&funcSets);
-}
-
 static void free_function_sets(void)
 {
     struct OIDFunctionSet *setCursor, *setNext;
@@ -100,8 +98,6 @@ static void free_function_sets(void)
         DeleteCriticalSection(&setCursor->cs);
         CryptMemFree(setCursor);
     }
-    funcSetCS.DebugInfo->Spare[0] = 0;
-    DeleteCriticalSection(&funcSetCS);
 }
 
 /* There is no free function associated with this; therefore, the sets are
@@ -849,7 +845,14 @@ LPCWSTR WINAPI CryptFindLocalizedName(LPCWSTR pwszCryptName)
 }
 
 static CRITICAL_SECTION oidInfoCS;
-static struct list oidInfo;
+static CRITICAL_SECTION_DEBUG oidInfoCSDebug =
+{
+    0, 0, &oidInfoCS,
+    { &oidInfoCSDebug.ProcessLocksList, &oidInfoCSDebug.ProcessLocksList },
+    0, 0, { (DWORD_PTR)(__FILE__ ": oidInfoCS") }
+};
+static CRITICAL_SECTION oidInfoCS = { &oidInfoCSDebug, -1, 0, 0, 0, 0 };
+static struct list oidInfo = { &oidInfo, &oidInfo };
 
 static const WCHAR tripledes[] = { '3','d','e','s',0 };
 static const WCHAR cms3deswrap[] = { 'C','M','S','3','D','E','S','w','r','a',
@@ -1190,9 +1193,6 @@ static void init_oid_info(HINSTANCE hinst)
 {
     DWORD i;
 
-    InitializeCriticalSection(&oidInfoCS);
-    oidInfoCS.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": oidInfoCS");
-    list_init(&oidInfo);
     for (i = 0; i < sizeof(oidInfoConstructors) /
      sizeof(oidInfoConstructors[0]); i++)
     {
@@ -1264,8 +1264,6 @@ static void free_oid_info(void)
         list_remove(&info->entry);
         CryptMemFree(info);
     }
-    oidInfoCS.DebugInfo->Spare[0] = 0;
-    DeleteCriticalSection(&oidInfoCS);
 }
 
 /***********************************************************************




More information about the wine-cvs mailing list