Skip to content

Commit f48c80a

Browse files
committed
better names
1 parent 32c5b7a commit f48c80a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/JlWrap/C.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const PyJuliaBase_Type = Ref(C.PyNULL)
1616

1717
# we store the actual julia values here
1818
# the `value` field of `PyJuliaValueObject` indexes into here
19-
const PYJLVALUES = Lockable((; values=IdDict{Int,Any}(), free=Int[], next=Ref(1)))
19+
const PYJLVALUES = Lockable((; values=IdDict{Int,Any}(), free_slots=Int[], next_slot=Ref(1)))
2020

2121
function _pyjl_new(t::C.PyPtr, ::C.PyPtr, ::C.PyPtr)
2222
o = ccall(UnsafePtr{C.PyTypeObject}(t).alloc[!], C.PyPtr, (C.PyPtr, C.Py_ssize_t), t, 0)
@@ -31,7 +31,7 @@ function _pyjl_dealloc(o::C.PyPtr)
3131
if idx != 0
3232
Base.@lock PYJLVALUES begin
3333
delete!(PYJLVALUES[].values, idx)
34-
push!(PYJLVALUES[].free, idx)
34+
push!(PYJLVALUES[].free_slots, idx)
3535
end
3636
end
3737
UnsafePtr{PyJuliaValueObject}(o).weaklist[!] == C.PyNULL || C.PyObject_ClearWeakRefs(o)
@@ -351,11 +351,11 @@ PyJuliaValue_SetValue(_o, @nospecialize(v)) = Base.GC.@preserve _o begin
351351
idx = UnsafePtr{PyJuliaValueObject}(o).value[]
352352
if idx == 0
353353
Base.@lock PYJLVALUES begin
354-
if isempty(PYJLVALUES[].free)
355-
idx = PYJLVALUES[].next[]
356-
PYJLVALUES[].next[] += 1
354+
if isempty(PYJLVALUES[].free_slots)
355+
idx = PYJLVALUES[].next_slot[]
356+
PYJLVALUES[].next_slot[] += 1
357357
else
358-
idx = pop!(PYJLVALUES[].free)
358+
idx = pop!(PYJLVALUES[].free_slots)
359359
end
360360
PYJLVALUES[].values[idx] = v
361361
end

0 commit comments

Comments
 (0)