summaryrefslogtreecommitdiff
path: root/plugins/pychrysa/format/symbol.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa/format/symbol.c')
-rw-r--r--plugins/pychrysa/format/symbol.c39
1 files changed, 5 insertions, 34 deletions
diff --git a/plugins/pychrysa/format/symbol.c b/plugins/pychrysa/format/symbol.c
index 53fb9c9..75f226a 100644
--- a/plugins/pychrysa/format/symbol.c
+++ b/plugins/pychrysa/format/symbol.c
@@ -85,8 +85,9 @@ static bool py_binary_symbol_define_constants(PyTypeObject *);
/******************************************************************************
* *
-* Paramètres : obj = objet Python à tenter de convertir. *
-* addr = structure équivalente pour Chrysalide. *
+* Paramètres : a = premier object Python à consulter. *
+* b = second object Python à consulter. *
+* op = type de comparaison menée. *
* *
* Description : Effectue une comparaison avec un objet Python 'BinSymbol'. *
* *
@@ -98,7 +99,7 @@ static bool py_binary_symbol_define_constants(PyTypeObject *);
static PyObject *py_binary_symbol_richcompare(PyObject *a, PyObject *b, int op)
{
- PyObject *result; /* Chaîne à retourner */
+ PyObject *result; /* Bilan à retourner */
int ret; /* Bilan de lecture des args. */
const GBinSymbol *sym_a; /* Premier élément à traiter */
const GBinSymbol *sym_b; /* Second élément à traiter */
@@ -116,37 +117,7 @@ static PyObject *py_binary_symbol_richcompare(PyObject *a, PyObject *b, int op)
status = g_binary_symbol_cmp(&sym_a, &sym_b);
- switch (op)
- {
- case Py_LT:
- result = status < 0 ? Py_True : Py_False;
- break;
-
- case Py_LE:
- result = status <= 0 ? Py_True : Py_False;
- break;
-
- case Py_EQ:
- result = status == 0 ? Py_True : Py_False;
- break;
-
- case Py_NE:
- result = status != 0 ? Py_True : Py_False;
- break;
-
- case Py_GT:
- result = status > 0 ? Py_True : Py_False;
- break;
-
- case Py_GE:
- result = status >= 0 ? Py_True : Py_False;
- break;
-
- default:
- result = Py_NotImplemented;
- break;
-
- }
+ result = status_to_rich_cmp_state(status, op);
cmp_done: