Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
flexatone committed Jul 11, 2024
1 parent f5d0f82 commit 11d1f63
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions arraymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,6 @@ typedef struct FAMIObject {
Py_ssize_t index; // current index state, mutated in-place
} FAMIObject;


static void
fami_dealloc(FAMIObject *self)
{
Expand Down Expand Up @@ -551,7 +550,6 @@ static PyTypeObject FAMIType = {
.tp_name = "arraymap.FrozenAutoMapIterator",
};


static PyObject *
fami_new(FAMObject *fam, ViewKind kind, bool reversed)
{
Expand Down Expand Up @@ -602,27 +600,23 @@ name(PyObject *left, PyObject *right) \
return result; \
}


FAMV_SET_OP(famv_and, And)
FAMV_SET_OP(famv_or, Or)
FAMV_SET_OP(famv_subtract, Subtract)
FAMV_SET_OP(famv_xor, Xor)

# undef FAMV_SET_OP


static PyNumberMethods famv_as_number = {
.nb_and = (binaryfunc) famv_and,
.nb_or = (binaryfunc) famv_or,
.nb_subtract = (binaryfunc) famv_subtract,
.nb_xor = (binaryfunc) famv_xor,
};


static int fam_contains(FAMObject *, PyObject *);
static PyObject *famv_fami_new(FAMVObject *);


static int
famv_contains(FAMVObject *self, PyObject *other)
{
Expand All @@ -638,41 +632,35 @@ famv_contains(FAMVObject *self, PyObject *other)
return result;
}


static PySequenceMethods famv_as_sequence = {
.sq_contains = (objobjproc) famv_contains,
};


static void
famv_dealloc(FAMVObject *self)
{
Py_DECREF(self->fam);
PyObject_Del((PyObject *)self);
}


static PyObject *
famv_fami_new(FAMVObject *self)
{
return fami_new(self->fam, self->kind, false);
}


static PyObject *
famv_length_hint(FAMVObject *self)
{
return PyLong_FromSsize_t(self->fam->keys_size);
}


static PyObject *
famv_reversed(FAMVObject *self)
{
return fami_new(self->fam, self->kind, true);
}


static PyObject *
famv_isdisjoint(FAMVObject *self, PyObject *other)
{
Expand All @@ -685,7 +673,6 @@ famv_isdisjoint(FAMVObject *self, PyObject *other)
return PyBool_FromLong(result);
}


static PyObject *
famv_richcompare(FAMVObject *self, PyObject *other, int op)
{
Expand All @@ -704,15 +691,13 @@ famv_richcompare(FAMVObject *self, PyObject *other, int op)
return result;
}


static PyMethodDef famv_methods[] = {
{"__length_hint__", (PyCFunction) famv_length_hint, METH_NOARGS, NULL},
{"__reversed__", (PyCFunction) famv_reversed, METH_NOARGS, NULL},
{"isdisjoint", (PyCFunction) famv_isdisjoint, METH_O, NULL},
{NULL},
};


static PyTypeObject FAMVType = {
PyVarObject_HEAD_INIT(NULL, 0)
.tp_as_number = &famv_as_number,
Expand All @@ -725,7 +710,6 @@ static PyTypeObject FAMVType = {
.tp_richcompare = (richcmpfunc) famv_richcompare,
};


static PyObject *
famv_new(FAMObject *fam, ViewKind kind)
{
Expand Down

0 comments on commit 11d1f63

Please sign in to comment.