aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/context.c
diff options
context:
space:
mode:
authorDonghee Na <donghee.na@python.org>2024-02-14 09:32:51 +0900
committerGitHub <noreply@github.com>2024-02-14 00:32:51 +0000
commitf15795c9a0f206b9abfb48007b267d12cd14f4a8 (patch)
tree1bd6b124e2ab983a921afb1c8ef02995ab39fb8b /Python/context.c
parent518af37eb569f52a3daf2cf9f4787deed10754ca (diff)
downloadcpython-f15795c9a0f206b9abfb48007b267d12cd14f4a8.tar.gz
cpython-f15795c9a0f206b9abfb48007b267d12cd14f4a8.zip
gh-111968: Rename freelist related struct names to Eric's suggestion (gh-115329)
Diffstat (limited to 'Python/context.c')
-rw-r--r--Python/context.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/Python/context.c b/Python/context.c
index e44fef705c3..01a21b47da5 100644
--- a/Python/context.c
+++ b/Python/context.c
@@ -65,11 +65,11 @@ contextvar_del(PyContextVar *var);
#ifdef WITH_FREELISTS
-static struct _Py_context_state *
-get_context_state(void)
+static struct _Py_context_freelist *
+get_context_freelist(void)
{
- _PyFreeListState *state = _PyFreeListState_GET();
- return &state->contexts;
+ struct _Py_object_freelists *freelists = _Py_object_freelists_GET();
+ return &freelists->contexts;
}
#endif
@@ -341,11 +341,11 @@ _context_alloc(void)
{
PyContext *ctx;
#ifdef WITH_FREELISTS
- struct _Py_context_state *state = get_context_state();
- if (state->numfree > 0) {
- state->numfree--;
- ctx = state->freelist;
- state->freelist = (PyContext *)ctx->ctx_weakreflist;
+ struct _Py_context_freelist *context_freelist = get_context_freelist();
+ if (context_freelist->numfree > 0) {
+ context_freelist->numfree--;
+ ctx = context_freelist->freelist;
+ context_freelist->freelist = (PyContext *)ctx->ctx_weakreflist;
OBJECT_STAT_INC(from_freelist);
ctx->ctx_weakreflist = NULL;
_Py_NewReference((PyObject *)ctx);
@@ -468,11 +468,11 @@ context_tp_dealloc(PyContext *self)
(void)context_tp_clear(self);
#ifdef WITH_FREELISTS
- struct _Py_context_state *state = get_context_state();
- if (state->numfree >= 0 && state->numfree < PyContext_MAXFREELIST) {
- state->numfree++;
- self->ctx_weakreflist = (PyObject *)state->freelist;
- state->freelist = self;
+ struct _Py_context_freelist *context_freelist = get_context_freelist();
+ if (context_freelist->numfree >= 0 && context_freelist->numfree < PyContext_MAXFREELIST) {
+ context_freelist->numfree++;
+ self->ctx_weakreflist = (PyObject *)context_freelist->freelist;
+ context_freelist->freelist = self;
OBJECT_STAT_INC(to_freelist);
}
else
@@ -1267,10 +1267,10 @@ get_token_missing(void)
void
-_PyContext_ClearFreeList(_PyFreeListState *freelist_state, int is_finalization)
+_PyContext_ClearFreeList(struct _Py_object_freelists *freelists, int is_finalization)
{
#ifdef WITH_FREELISTS
- struct _Py_context_state *state = &freelist_state->contexts;
+ struct _Py_context_freelist *state = &freelists->contexts;
for (; state->numfree > 0; state->numfree--) {
PyContext *ctx = state->freelist;
state->freelist = (PyContext *)ctx->ctx_weakreflist;