[ctypes-commit] ctypes/source callproc.c,1.160,1.161
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2006-03-17 21:07:32
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8240 Modified Files: callproc.c Log Message: Include <malloc.h>, for compatibility with mingw. Don't use SEH on Windows, when compiling with MingW, or in debug mode. Rename the CPP definition. Index: callproc.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callproc.c,v retrieving revision 1.160 retrieving revision 1.161 diff -C2 -d -r1.160 -r1.161 *** callproc.c 17 Mar 2006 15:12:22 -0000 1.160 --- callproc.c 17 Mar 2006 21:07:27 -0000 1.161 *************** *** 65,69 **** #ifdef MS_WIN32 ! #define alloca _alloca #endif --- 65,69 ---- #ifdef MS_WIN32 ! #include <malloc.h> #endif *************** *** 71,76 **** #include "ctypes.h" ! #ifdef _DEBUG ! #define DEBUG_EXCEPTIONS /* */ #endif --- 71,79 ---- #include "ctypes.h" ! #if defined(_DEBUG) || defined(__MINGW32__) ! /* Don't use structured exception handling on Windows if this is defined. ! MingW, AFAIK, doesn't support it. ! */ ! #define DONT_USE_SEH #endif *************** *** 97,100 **** --- 100,104 ---- } + #ifndef DONT_USE_SEH void SetException(DWORD code, EXCEPTION_RECORD *pr) { *************** *** 255,258 **** --- 259,263 ---- return EXCEPTION_EXECUTE_HANDLER; } + #endif static PyObject * *************** *** 613,619 **** --- 618,626 ---- #ifdef MS_WIN32 int delta; + #ifndef DONT_USE_SEH DWORD dwExceptionCode = 0; EXCEPTION_RECORD record; #endif + #endif /* XXX check before here */ if (restype == NULL) { *************** *** 641,645 **** Py_UNBLOCK_THREADS #ifdef MS_WIN32 ! #ifndef DEBUG_EXCEPTIONS __try { #endif --- 648,652 ---- Py_UNBLOCK_THREADS #ifdef MS_WIN32 ! #ifndef DONT_USE_SEH __try { #endif *************** *** 648,652 **** ffi_call(&cif, (void *)pProc, resmem, avalues); #ifdef MS_WIN32 ! #ifndef DEBUG_EXCEPTIONS } __except (HandleException(GetExceptionInformation(), --- 655,659 ---- ffi_call(&cif, (void *)pProc, resmem, avalues); #ifdef MS_WIN32 ! #ifndef DONT_USE_SEH } __except (HandleException(GetExceptionInformation(), *************** *** 659,666 **** --- 666,675 ---- Py_BLOCK_THREADS #ifdef MS_WIN32 + #ifndef DONT_USE_SEH if (dwExceptionCode) { SetException(dwExceptionCode, &record); return -1; } + #endif if (delta < 0) { if (flags & FUNCFLAG_CDECL) |