Skip to content

Commit

Permalink
Meta->generation from PyObject* to void*
Browse files Browse the repository at this point in the history
  • Loading branch information
dpdani committed Sep 29, 2024
1 parent 633874d commit c21d846
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/cereggii/atomic_dict/atomic_dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ AtomicDict_Debug(AtomicDict *self)
meta = (AtomicDict_Meta *) AtomicRef_Get(self->metadata);
metadata = Py_BuildValue("{sOsOsOsOsOsOsOsOsOsOsOsOsOsOsO}",
"log_size\0", Py_BuildValue("B", meta->log_size),
"generation\0", Py_BuildValue("O", meta->generation),
"generation\0", Py_BuildValue("n", (Py_ssize_t) meta->generation),
"node_size\0", Py_BuildValue("B", meta->node_size),
"distance_size\0", Py_BuildValue("B", meta->distance_size),
"tag_size\0", Py_BuildValue("B", meta->tag_size),
Expand Down Expand Up @@ -622,7 +622,7 @@ AtomicDict_Debug(AtomicDict *self)
}
}

block_info = Py_BuildValue("{sOsO}",
block_info = Py_BuildValue("{snsO}",
"gen\0", block->generation,
"entries\0", entries);
Py_DECREF(entries);
Expand Down
2 changes: 0 additions & 2 deletions src/cereggii/atomic_dict/blocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ AtomicDictBlock_New(AtomicDict_Meta *meta)
void
AtomicDictBlock_dealloc(AtomicDict_Block *self)
{
Py_CLEAR(self->generation);

AtomicDict_Entry entry;
for (int i = 0; i < ATOMIC_DICT_ENTRIES_IN_BLOCK; ++i) {
entry = self->entries[i];
Expand Down
4 changes: 2 additions & 2 deletions src/cereggii/atomic_dict/meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ AtomicDictMeta_New(uint8_t log_size)

AtomicDict_NodeSizeInfo node_sizes = AtomicDict_NodeSizesTable[log_size];

generation = PyObject_CallObject((PyObject *) &PyBaseObject_Type, NULL);
generation = PyMem_RawMalloc(1);
if (generation == NULL)
goto fail;

Expand Down Expand Up @@ -251,7 +251,7 @@ AtomicDictMeta_dealloc(AtomicDict_Meta *self)
PyMem_RawFree(self->blocks);
}

Py_CLEAR(self->generation);
PyMem_RawFree(self->generation);
Py_CLEAR(self->new_gen_metadata);
Py_CLEAR(self->new_metadata_ready);
Py_CLEAR(self->node_migration_done);
Expand Down
2 changes: 1 addition & 1 deletion src/include/atomic_dict_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ struct AtomicDict_Meta {
uint8_t log_size; // = node index_size
uint64_t size;

PyObject *generation;
void *generation;

uint64_t *index;

Expand Down

0 comments on commit c21d846

Please sign in to comment.