Removed a number of global handle allocations and critical section

initializations.
This commit is contained in:
Alexandre Julliard 2000-04-08 21:06:06 +00:00
parent 11342151c9
commit 227a0894d4
15 changed files with 13 additions and 72 deletions

View File

@ -13,9 +13,9 @@
#include "winversion.h"
#include "wine/undocshell.h"
DEFAULT_DEBUG_CHANNEL(shell)
DEFAULT_DEBUG_CHANNEL(shell);
static CRITICAL_SECTION SHELL32_ChangenotifyCS;
static CRITICAL_SECTION SHELL32_ChangenotifyCS = CRITICAL_SECTION_INIT;
/* internal list of notification clients (internal) */
typedef struct _NOTIFICATIONLIST
@ -30,17 +30,12 @@ typedef struct _NOTIFICATIONLIST
DWORD dwFlags; /* client flags */
} NOTIFICATIONLIST, *LPNOTIFICATIONLIST;
NOTIFICATIONLIST head;
NOTIFICATIONLIST tail;
static NOTIFICATIONLIST head;
static NOTIFICATIONLIST tail;
void InitChangeNotifications()
{
TRACE("head=%p tail=%p\n", &head, &tail);
InitializeCriticalSection(&SHELL32_ChangenotifyCS);
MakeCriticalSectionGlobal(&SHELL32_ChangenotifyCS);
ZeroMemory(&head, sizeof(NOTIFICATIONLIST));
ZeroMemory(&tail, sizeof(NOTIFICATIONLIST));
head.next = &tail;
tail.prev = &head;
}

View File

@ -451,7 +451,7 @@ typedef struct
} SIC_ENTRY, * LPSIC_ENTRY;
static HDPA sic_hdpa = 0;
static CRITICAL_SECTION SHELL32_SicCS;
static CRITICAL_SECTION SHELL32_SicCS = CRITICAL_SECTION_INIT;
/*****************************************************************************
* SIC_CompareEntrys [called by comctl32.dll]
@ -612,9 +612,6 @@ BOOL SIC_Initialize(void)
if (sic_hdpa) /* already initialized?*/
return TRUE;
InitializeCriticalSection(&SHELL32_SicCS);
MakeCriticalSectionGlobal(&SHELL32_SicCS);
sic_hdpa = pDPA_Create(16);
if (!sic_hdpa)

View File

@ -7,7 +7,6 @@
#include "winuser.h"
#include "wine/winbase16.h"
#include "cursoricon.h"
#include "dce.h"
#include "dialog.h"
#include "display.h"
@ -61,15 +60,9 @@ BOOL WINAPI USER_Init(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
/* Create the DCEs */
DCE_Init();
/* Initialize timers */
if (!TIMER_Init()) return FALSE;
/* Initialize window procedures */
if (!WINPROC_Init()) return FALSE;
/* Initialize cursor/icons */
CURSORICON_Init();
/* Initialize built-in window classes */
if (!WIDGETS_Init()) return FALSE;

View File

@ -156,10 +156,6 @@ static void process_attach(void)
CLIPBOARD_Driver = &X11DRV_CLIPBOARD_Driver;
WND_Driver = &X11DRV_WND_Driver;
/* We need this before calling any Xlib function */
InitializeCriticalSection( &X11DRV_CritSection );
MakeCriticalSectionGlobal( &X11DRV_CritSection );
putenv("XKB_DISABLE="); /* Disable XKB extension if present. */
/* Open display */

View File

@ -81,7 +81,7 @@ static char PROFILE_WineIniUsed[MAX_PATHNAME_LEN] = "";
static const WCHAR wininiW[] = { 'w','i','n','.','i','n','i',0 };
static CRITICAL_SECTION PROFILE_CritSect;
static CRITICAL_SECTION PROFILE_CritSect = CRITICAL_SECTION_INIT;
static const char hex[16] = "0123456789ABCDEF";
@ -944,10 +944,6 @@ int PROFILE_LoadWineIni(void)
ERR("Cannot create config registry key\n" );
return 0;
}
wine_profile_key = ConvertToGlobalHandle( wine_profile_key );
InitializeCriticalSection( &PROFILE_CritSect );
MakeCriticalSectionGlobal( &PROFILE_CritSect );
if (!CLIENT_IsBootThread()) return 1; /* already loaded */

View File

@ -208,7 +208,7 @@ static fontEncodingTemplate* fETTable = __fETTable;
static int DefResolution = 0;
static CRITICAL_SECTION crtsc_fonts_X11;
static CRITICAL_SECTION crtsc_fonts_X11 = CRITICAL_SECTION_INIT;
static fontResource* fontList = NULL;
static fontObject* fontCache = NULL; /* array */
@ -2628,9 +2628,6 @@ BOOL X11DRV_FONT_Init( DeviceCaps* pDevCaps )
XFONT_LoadDefaults();
XFONT_LoadIgnores();
InitializeCriticalSection( &crtsc_fonts_X11 );
MakeCriticalSectionGlobal( &crtsc_fonts_X11 );
/* fontList initialization is over, allocate X font cache */
fontCache = (fontObject*) HeapAlloc(GetProcessHeap(), 0, fontCacheSize * sizeof(fontObject));

View File

@ -70,8 +70,6 @@ typedef struct
#define CID_WIN32 0x0004
#define CID_NONSHARED 0x0008
extern void CURSORICON_Init( void );
extern HCURSOR16 CURSORICON_IconToCursor( HICON16 hIcon,
BOOL bSemiTransparent );

View File

@ -19,7 +19,6 @@ extern BOOL MSG_InternalGetMessage( int type, struct tagMSG *msg, HWND hwnd,
WORD flags, BOOL sendIdle, BOOL* idleSent );
/* timer.c */
extern BOOL TIMER_Init( void );
extern void TIMER_RemoveWindowTimers( HWND hwnd );
extern void TIMER_RemoveQueueTimers( HQUEUE16 hqueue );
extern BOOL TIMER_GetTimerMsg( struct tagMSG *msg, HWND hwnd,

View File

@ -384,9 +384,6 @@ HANDLE NE_OpenFile( NE_MODULE *pModule )
if ((cachedfd = CreateFileA( name, GENERIC_READ, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, -1 )) == -1)
MESSAGE( "Can't open file '%s' for module %04x\n", name, pModule->self );
else
/* FIXME: should not be necessary */
cachedfd = ConvertToGlobalHandle(cachedfd);
TRACE("opened '%s' -> %d\n",
name, cachedfd );
return cachedfd;

View File

@ -535,10 +535,7 @@ static BOOL HEAP_InitSubHeap( HEAP *heap, LPVOID address, DWORD flags,
/* Initialize critical section */
InitializeCriticalSection( &heap->critSection );
/* FIXME: once separate address spaces are implemented, only */
/* the SystemHeap critical section should be global */
/* if (!SystemHeap) */
MakeCriticalSectionGlobal( &heap->critSection );
if (!SystemHeap) MakeCriticalSectionGlobal( &heap->critSection );
}
/* Create the first free block */

View File

@ -36,7 +36,7 @@ static int *ph_errno = &h_errno;
DEFAULT_DEBUG_CHANNEL(thread)
/* Xlib critical section (FIXME: does not belong here) */
CRITICAL_SECTION X11DRV_CritSection = { 0, };
CRITICAL_SECTION X11DRV_CritSection = CRITICAL_SECTION_INIT;
#ifdef linux
# ifdef HAVE_SCHED_H

View File

@ -59,7 +59,6 @@ SEGPTR WINAPI GetpWin16Lock16(void)
VOID WINAPI _CreateSysLevel(SYSLEVEL *lock, INT level)
{
InitializeCriticalSection( &lock->crst );
MakeCriticalSectionGlobal( &lock->crst );
lock->level = level;
TRACE("(%p, %d): handle is %d\n",

View File

@ -82,18 +82,9 @@ typedef struct tagICONCACHE
} ICONCACHE;
static ICONCACHE *IconAnchor = NULL;
static CRITICAL_SECTION IconCrst;
static CRITICAL_SECTION IconCrst = CRITICAL_SECTION_INIT;
static DWORD ICON_HOTSPOT = 0x42424242;
/**********************************************************************
* CURSORICON_Init
*/
void CURSORICON_Init( void )
{
InitializeCriticalSection( &IconCrst );
MakeCriticalSectionGlobal( &IconCrst );
}
/**********************************************************************
* CURSORICON_FindSharedIcon
*/

View File

@ -37,21 +37,7 @@ typedef struct tagTIMER
static TIMER TimersArray[NB_TIMERS];
static CRITICAL_SECTION csTimer;
/***********************************************************************
* TIMER_Init
*
* Initialize critical section for the timer.
*/
BOOL TIMER_Init( void )
{
InitializeCriticalSection( &csTimer );
MakeCriticalSectionGlobal( &csTimer );
return TRUE;
}
static CRITICAL_SECTION csTimer = CRITICAL_SECTION_INIT;
/***********************************************************************

View File

@ -2041,7 +2041,7 @@ int X11DRV_EVENT_PrepareShmCompletion( Drawable dw )
int n;
if (!shm_read)
shm_read = ConvertToGlobalHandle( FILE_DupUnixHandle( ConnectionNumber(display), GENERIC_READ | SYNCHRONIZE ) );
shm_read = FILE_DupUnixHandle( ConnectionNumber(display), GENERIC_READ | SYNCHRONIZE );
for (n=0; n<SHM_MAX_Q; n++)
if (!shm_q[n].draw)
@ -2055,7 +2055,7 @@ int X11DRV_EVENT_PrepareShmCompletion( Drawable dw )
shm_q[n].state = 0;
if (!shm_q[n].sema) {
shm_q[n].sema = ConvertToGlobalHandle( CreateSemaphoreA( NULL, 0, 256, NULL ) );
shm_q[n].sema = CreateSemaphoreA( NULL, 0, 256, NULL );
TRACE("Allocated ShmCompletion slots have been increased to %d, new semaphore is %x\n", n+1, shm_q[n].sema);
}