[ctypes-commit] ctypes/source callproc.c,1.117,1.118
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2004-12-02 18:26:29
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22987 Modified Files: callproc.c Log Message: Refactoring. Change the signature of _call_function_pointer to not require a 'struct argument' arg for the result any more. Index: callproc.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/callproc.c,v retrieving revision 1.117 retrieving revision 1.118 diff -C2 -d -r1.117 -r1.118 *** callproc.c 2 Dec 2004 17:27:19 -0000 1.117 --- callproc.c 2 Dec 2004 18:26:21 -0000 1.118 *************** *** 609,613 **** void **avalues, ffi_type **atypes, ! struct argument *res, int argcount) { --- 609,614 ---- void **avalues, ffi_type **atypes, ! ffi_type *restype, ! void *resmem, int argcount) { *************** *** 621,625 **** #endif /* XXX check before here */ ! if (res->ffi_type == NULL) { PyErr_SetString(PyExc_RuntimeError, "No ffi_type for result"); --- 622,626 ---- #endif /* XXX check before here */ ! if (restype == NULL) { PyErr_SetString(PyExc_RuntimeError, "No ffi_type for result"); *************** *** 636,640 **** cc, argcount, ! res->ffi_type, atypes)) { PyErr_SetString(PyExc_RuntimeError, --- 637,641 ---- cc, argcount, ! restype, atypes)) { PyErr_SetString(PyExc_RuntimeError, *************** *** 651,655 **** delta = #endif ! ffi_call(&cif, (void *)pProc, &res->value, avalues); #ifdef MS_WIN32 #ifndef DEBUG_EXCEPTIONS --- 652,656 ---- delta = #endif ! ffi_call(&cif, (void *)pProc, resmem, avalues); #ifdef MS_WIN32 #ifndef DEBUG_EXCEPTIONS *************** *** 906,909 **** --- 907,916 ---- } + /* XXX If we have a structure as return value, the storage area that + 'result.value' provides may not be large enough. We should + probably create the result value (an instance of the structure + type) before the call, and use the instance's memory buffer as the + storage area. + */ result.ffi_type = GetType(restype); *************** *** 918,922 **** } ! if (-1 == _call_function_pointer(flags, pProc, avalues, atypes, &result, argcount)) goto cleanup; --- 925,930 ---- } ! if (-1 == _call_function_pointer(flags, pProc, avalues, atypes, ! result.ffi_type, &result.value, argcount)) goto cleanup; |