[ctypes-commit] ctypes/source _ctypes.c,1.248,1.249
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2005-03-31 09:58:25
|
Update of /cvsroot/ctypes/ctypes/source In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24082 Modified Files: _ctypes.c Log Message: Inline CData_set in Pointer_ass_item also, and remove CData_set completely. Index: _ctypes.c =================================================================== RCS file: /cvsroot/ctypes/ctypes/source/_ctypes.c,v retrieving revision 1.248 retrieving revision 1.249 diff -C2 -d -r1.248 -r1.249 *** _ctypes.c 31 Mar 2005 09:47:08 -0000 1.248 --- _ctypes.c 31 Mar 2005 09:57:47 -0000 1.249 *************** *** 2004,2009 **** /* ! Helper function for CData_set below. ! */ static PyObject * _CData_set(CDataObject *dst, PyObject *type, PyObject *value, --- 2004,2010 ---- /* ! * Set a slice in object 'dst', which has the type 'type', ! * to the value 'value'. ! */ static PyObject * _CData_set(CDataObject *dst, PyObject *type, PyObject *value, *************** *** 2086,2108 **** } - /* - * Set a slice in object 'dst', which has the type 'type', - * to the value 'value'. - */ - static int - CData_set(CDataObject *dst, PyObject *type, PyObject *value, - int index, int size, char *ptr) - { - PyObject *result = _CData_set(dst, type, value, - size, ptr); - if (result == NULL) - return -1; - - /* KeepRef steals a refcount from it's last argument */ - /* If KeepRef fails, we are stumped. The dst memory block has already - been changed */ - return KeepRef(dst, index, result); - } - /******************************************************************/ --- 2087,2090 ---- *************** *** 3761,3764 **** --- 3743,3747 ---- int size; StgDictObject *stgdict; + PyObject *keep; if (value == NULL) { *************** *** 3782,3788 **** size = stgdict->size / stgdict->length; ! /* XXXXX Make sure proto is NOT NULL! */ ! return CData_set(self, stgdict->proto, value, ! index, size, *(void **)self->b_ptr); } --- 3765,3773 ---- size = stgdict->size / stgdict->length; ! keep = _CData_set(self, stgdict->proto, value, ! size, *(void **)self->b_ptr); ! if (keep == NULL) ! return -1; ! return KeepRef(self, index, keep); } |