@@ -39,9 +39,6 @@ pgSurface_LockBy(pgSurfaceObject *, PyObject *);
3939static int
4040pgSurface_UnlockBy (pgSurfaceObject * , PyObject * );
4141
42- static void
43- _lifelock_dealloc (PyObject * );
44-
4542static void
4643pgSurface_Prep (pgSurfaceObject * surfobj )
4744{
@@ -169,51 +166,6 @@ pgSurface_UnlockBy(pgSurfaceObject *surfobj, PyObject *lockobj)
169166 return noerror ;
170167}
171168
172- static PyTypeObject pgLifetimeLock_Type = {
173- PyVarObject_HEAD_INIT (NULL , 0 ).tp_name = "pygame.surflock.SurfLifeLock" ,
174- .tp_basicsize = sizeof (pgLifetimeLockObject ),
175- .tp_dealloc = _lifelock_dealloc ,
176- .tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE ,
177- .tp_weaklistoffset = offsetof(pgLifetimeLockObject , weakrefs ),
178- };
179-
180- /* lifetimelock object internals */
181- static void
182- _lifelock_dealloc (PyObject * self )
183- {
184- pgLifetimeLockObject * lifelock = (pgLifetimeLockObject * )self ;
185-
186- if (lifelock -> weakrefs != NULL ) {
187- PyObject_ClearWeakRefs (self );
188- }
189-
190- pgSurface_UnlockBy ((pgSurfaceObject * )lifelock -> surface ,
191- lifelock -> lockobj );
192- Py_DECREF (lifelock -> surface );
193- Py_TYPE (self )-> tp_free (self );
194- }
195-
196- static PyObject *
197- pgSurface_LockLifetime (PyObject * surfobj , PyObject * lockobj )
198- {
199- pgLifetimeLockObject * life ;
200- if (surfobj == NULL ) {
201- return RAISE (pgExc_SDLError , SDL_GetError ());
202- }
203-
204- life = PyObject_New (pgLifetimeLockObject , & pgLifetimeLock_Type );
205- if (life != NULL ) {
206- life -> surface = surfobj ;
207- life -> lockobj = lockobj ;
208- life -> weakrefs = NULL ;
209- Py_INCREF (surfobj );
210- if (!pgSurface_LockBy ((pgSurfaceObject * )surfobj , lockobj )) {
211- return NULL ;
212- }
213- }
214- return (PyObject * )life ;
215- }
216-
217169static PyMethodDef _surflock_methods [] = {{NULL , NULL , 0 , NULL }};
218170
219171/*DOC*/ static char _surflock_doc [] =
@@ -234,25 +186,19 @@ MODINIT_DEFINE(surflock)
234186 NULL ,
235187 NULL };
236188
237- if (PyType_Ready (& pgLifetimeLock_Type ) < 0 ) {
238- return NULL ;
239- }
240-
241189 /* Create the module and add the functions */
242190 module = PyModule_Create (& _module );
243191 if (module == NULL ) {
244192 return NULL ;
245193 }
246194
247195 /* export the c api */
248- c_api [0 ] = & pgLifetimeLock_Type ;
249- c_api [1 ] = pgSurface_Prep ;
250- c_api [2 ] = pgSurface_Unprep ;
251- c_api [3 ] = pgSurface_Lock ;
252- c_api [4 ] = pgSurface_Unlock ;
253- c_api [5 ] = pgSurface_LockBy ;
254- c_api [6 ] = pgSurface_UnlockBy ;
255- c_api [7 ] = pgSurface_LockLifetime ;
196+ c_api [0 ] = pgSurface_Prep ;
197+ c_api [1 ] = pgSurface_Unprep ;
198+ c_api [2 ] = pgSurface_Lock ;
199+ c_api [3 ] = pgSurface_Unlock ;
200+ c_api [4 ] = pgSurface_LockBy ;
201+ c_api [5 ] = pgSurface_UnlockBy ;
256202 apiobj = encapsulate_api (c_api , "surflock" );
257203 if (PyModule_AddObject (module , PYGAMEAPI_LOCAL_ENTRY , apiobj )) {
258204 Py_XDECREF (apiobj );
0 commit comments