Lines Matching refs:modstate

35 atexit_delete_cb(atexitmodule_state *modstate, int i)  in atexit_delete_cb()  argument
39 cb = modstate->atexit_callbacks[i]; in atexit_delete_cb()
40 modstate->atexit_callbacks[i] = NULL; in atexit_delete_cb()
49 atexit_cleanup(atexitmodule_state *modstate) in atexit_cleanup() argument
53 for (i = 0; i < modstate->ncallbacks; i++) { in atexit_cleanup()
54 cb = modstate->atexit_callbacks[i]; in atexit_cleanup()
58 atexit_delete_cb(modstate, i); in atexit_cleanup()
60 modstate->ncallbacks = 0; in atexit_cleanup()
70 atexitmodule_state *modstate; in atexit_callfuncs() local
75 modstate = GET_ATEXIT_STATE(module); in atexit_callfuncs()
77 if (modstate->ncallbacks == 0) in atexit_callfuncs()
81 for (i = modstate->ncallbacks - 1; i >= 0; i--) in atexit_callfuncs()
83 cb = modstate->atexit_callbacks[i]; in atexit_callfuncs()
106 atexit_cleanup(modstate); in atexit_callfuncs()
129 atexitmodule_state *modstate; in atexit_register() local
133 modstate = GET_ATEXIT_STATE(self); in atexit_register()
135 if (modstate->ncallbacks >= modstate->callback_len) { in atexit_register()
137 modstate->callback_len += 16; in atexit_register()
138 r = (atexit_callback**)PyMem_Realloc(modstate->atexit_callbacks, in atexit_register()
139 sizeof(atexit_callback*) * modstate->callback_len); in atexit_register()
142 modstate->atexit_callbacks = r; in atexit_register()
172 modstate->atexit_callbacks[modstate->ncallbacks++] = new_callback; in atexit_register()
212 atexitmodule_state *modstate; in atexit_ncallbacks() local
214 modstate = GET_ATEXIT_STATE(self); in atexit_ncallbacks()
216 return PyLong_FromSsize_t(modstate->ncallbacks); in atexit_ncallbacks()
223 atexitmodule_state *modstate; in atexit_m_traverse() local
225 modstate = GET_ATEXIT_STATE(self); in atexit_m_traverse()
226 if (modstate != NULL) { in atexit_m_traverse()
227 for (i = 0; i < modstate->ncallbacks; i++) { in atexit_m_traverse()
228 atexit_callback *cb = modstate->atexit_callbacks[i]; in atexit_m_traverse()
242 atexitmodule_state *modstate; in atexit_m_clear() local
243 modstate = GET_ATEXIT_STATE(self); in atexit_m_clear()
244 if (modstate != NULL) { in atexit_m_clear()
245 atexit_cleanup(modstate); in atexit_m_clear()
253 atexitmodule_state *modstate; in atexit_free() local
254 modstate = GET_ATEXIT_STATE(m); in atexit_free()
255 if (modstate != NULL) { in atexit_free()
256 atexit_cleanup(modstate); in atexit_free()
257 PyMem_Free(modstate->atexit_callbacks); in atexit_free()
272 atexitmodule_state *modstate; in atexit_unregister() local
276 modstate = GET_ATEXIT_STATE(self); in atexit_unregister()
278 for (i = 0; i < modstate->ncallbacks; i++) in atexit_unregister()
280 cb = modstate->atexit_callbacks[i]; in atexit_unregister()
288 atexit_delete_cb(modstate, i); in atexit_unregister()
319 atexitmodule_state *modstate; in atexit_exec() local
321 modstate = GET_ATEXIT_STATE(m); in atexit_exec()
322 modstate->callback_len = 32; in atexit_exec()
323 modstate->ncallbacks = 0; in atexit_exec()
324 modstate->atexit_callbacks = PyMem_New(atexit_callback*, in atexit_exec()
325 modstate->callback_len); in atexit_exec()
326 if (modstate->atexit_callbacks == NULL) in atexit_exec()