Re: [PATCH] gcc 2.95 fixes
Bryan Kadzban <[email protected]>
| Newsgroups | gmane.comp.emulators.winex.devel |
|---|---|
| Message-ID | <[email protected]> |
[email protected] wrote: > The attached patch makes gcc 2.95 happy. Also it is just good > practice to declare variables at the top of their scope. I'd > appreciate it if it was applied to CVS. It may make gcc happy to declare variables at the top, but it'll make the system much, much happier to initialize variables where they had been initialized before. *ESPECIALLY* when that initialization is going to affect inter-thread synchronization... The second patch (the one in http.c) isn't going to affect anything, but the first one (in critsection.c) could very easily deadlock. It's much better to actually wait on the critical section's semaphore in the same place that it's being waited on in the current CVS code (i.e., *after* the entry and contention counts are atomically incremented, not before -- otherwise, if the atomic increment affects the signaled state of the semaphore, then your patch could cause a deadlock). Something like the attached is going to be a lot safer (plus it applies more cleanly to current CVS).
winex.patch
(text/plain, 1.1 KB)
diff -urN winex/dlls/ntdll/critsection.c winex-old/dlls/ntdll/critsection.c
--- winex/dlls/ntdll/critsection.c 25 Mar 2004 15:21:51 -0000
+++ winex-old/dlls/ntdll/critsection.c 26 Mar 2004 23:16:46 -0000
@@ -397,6 +397,7 @@
{
EXCEPTION_RECORD rec;
HANDLE sem = get_semaphore( crit );
+ DWORD res;
/* MSDN article seems to say that these both have same purpose */
#if defined( USE_PTHREADS )
@@ -407,7 +408,7 @@
}
#endif
- DWORD res = WaitForSingleObject( sem, 5000L );
+ res = WaitForSingleObject( sem, 5000L );
if ( res == WAIT_TIMEOUT )
{
display_wait_error( crit, "Timeout. Retry with 60 secs" );
diff -urN winex/dlls/wininet/http.c winex-old/dlls/wininet/http.c
--- winex/dlls/wininet/http.c 20 Feb 2004 12:50:35 -0000
+++ winex-old/dlls/wininet/http.c 26 Mar 2004 23:16:48 -0000
@@ -153,10 +153,11 @@
LPCWSTR lpszHeader, DWORD dwHeaderLength, DWORD dwModifier)
{
CHAR *szHeader = NULL;
+ BOOL ret;
TRACE("->\n");
- BOOL ret = FALSE;
+ ret = FALSE;
if (lpszHeader)
{