Skip to content

Commit 4086ff0

Browse files
committed
Remove Pycairo_richcompare
provided by Python itself now
1 parent 25cdbbf commit 4086ff0

8 files changed

Lines changed: 7 additions & 42 deletions

File tree

cairo/context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,7 +1517,7 @@ static PyObject*
15171517
pycairo_richcompare (PyObject *self, PyObject *other, int op)
15181518
{
15191519
if (Py_TYPE(self) == Py_TYPE(other))
1520-
return Pycairo_richcompare (
1520+
Py_RETURN_RICHCOMPARE (
15211521
((PycairoContext *)self)->ctx,
15221522
((PycairoContext *)other)->ctx,
15231523
op);

cairo/device.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static PyObject*
107107
device_richcompare (PyObject *self, PyObject *other, int op)
108108
{
109109
if (Py_TYPE(self) == Py_TYPE(other))
110-
return Pycairo_richcompare (
110+
Py_RETURN_RICHCOMPARE (
111111
((PycairoDevice *)self)->device,
112112
((PycairoDevice *)other)->device,
113113
op);

cairo/font.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static PyObject*
9797
font_face_richcompare (PyObject *self, PyObject *other, int op)
9898
{
9999
if (Py_TYPE(self) == Py_TYPE(other))
100-
return Pycairo_richcompare (
100+
Py_RETURN_RICHCOMPARE (
101101
((PycairoFontFace *)self)->font_face,
102102
((PycairoFontFace *)other)->font_face,
103103
op);
@@ -534,7 +534,7 @@ static PyObject*
534534
scaled_font_richcompare (PyObject *self, PyObject *other, int op)
535535
{
536536
if (Py_TYPE(self) == Py_TYPE(other))
537-
return Pycairo_richcompare (
537+
Py_RETURN_RICHCOMPARE (
538538
((PycairoScaledFont *)self)->scaled_font,
539539
((PycairoScaledFont *)other)->scaled_font,
540540
op);

cairo/misc.c

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -143,36 +143,3 @@ Pycairo_fspath_none_converter (PyObject *obj, char** result) {
143143

144144
return Pycairo_fspath_converter (obj, result);
145145
}
146-
147-
PyObject*
148-
Pycairo_richcompare (void* a, void *b, int op)
149-
{
150-
PyObject *res;
151-
152-
switch (op) {
153-
case Py_EQ:
154-
res = (a == b) ? Py_True : Py_False;
155-
break;
156-
case Py_NE:
157-
res = (a != b) ? Py_True : Py_False;
158-
break;
159-
case Py_LT:
160-
res = (a < b) ? Py_True : Py_False;
161-
break;
162-
case Py_LE:
163-
res = (a <= b) ? Py_True : Py_False;
164-
break;
165-
case Py_GT:
166-
res = (a > b) ? Py_True : Py_False;
167-
break;
168-
case Py_GE:
169-
res = (a >= b) ? Py_True : Py_False;
170-
break;
171-
default:
172-
res = Py_NotImplemented;
173-
break;
174-
}
175-
176-
Py_INCREF (res);
177-
return res;
178-
}

cairo/path.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ static PyObject*
168168
path_richcompare (PyObject *self, PyObject *other, int op)
169169
{
170170
if (Py_TYPE(self) == Py_TYPE(other))
171-
return Pycairo_richcompare (
171+
Py_RETURN_RICHCOMPARE (
172172
((PycairoPath *)self)->path,
173173
((PycairoPath *)other)->path,
174174
op);

cairo/pattern.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static PyObject*
223223
pattern_richcompare (PyObject *self, PyObject *other, int op)
224224
{
225225
if (Py_TYPE(self) == Py_TYPE(other))
226-
return Pycairo_richcompare (
226+
Py_RETURN_RICHCOMPARE (
227227
((PycairoPattern *)self)->pattern,
228228
((PycairoPattern *)other)->pattern,
229229
op);

cairo/private.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ int _PyGlyph_AsGlyph (PyObject *pyobj, cairo_glyph_t *glyph);
5959
int _PyTextCluster_AsTextCluster (PyObject *pyobj,
6060
cairo_text_cluster_t *cluster);
6161

62-
PyObject* Pycairo_richcompare (void* a, void *b, int op);
63-
6462
extern PyTypeObject PycairoContext_Type;
6563
PyObject *PycairoContext_FromContext (cairo_t *ctx, PyTypeObject *type,
6664
PyObject *base);

cairo/surface.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ static PyObject*
753753
surface_richcompare (PyObject *self, PyObject *other, int op)
754754
{
755755
if (Py_TYPE(self) == Py_TYPE(other))
756-
return Pycairo_richcompare (
756+
Py_RETURN_RICHCOMPARE (
757757
((PycairoSurface *)self)->surface,
758758
((PycairoSurface *)other)->surface,
759759
op);

0 commit comments

Comments
 (0)