summaryrefslogtreecommitdiff
path: root/plugins/pychrysa
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysa')
-rw-r--r--plugins/pychrysa/arch/instruction.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/plugins/pychrysa/arch/instruction.c b/plugins/pychrysa/arch/instruction.c
index 67e3a6b..0e10728 100644
--- a/plugins/pychrysa/arch/instruction.c
+++ b/plugins/pychrysa/arch/instruction.c
@@ -106,32 +106,34 @@ static PyObject *py_arch_instruction_get_sources(PyObject *self, void *unused)
{
PyObject *result; /* Instance à retourner */
GArchInstruction *instr; /* Version native */
- instr_link_t *sources; /* Origine des liens */
+ instr_link_t *source; /* Origine des liens */
size_t count; /* Nombre de liens présents */
size_t i; /* Boucle de parcours */
- PyObject *dest; /* Destination de lien Python */
+ PyObject *linked; /* Source de lien Python */
PyObject *type; /* Nature du lien en Python */
int ret; /* Bilan d'une écriture d'arg. */
instr = G_ARCH_INSTRUCTION(pygobject_get(self));
- g_arch_instruction_rlock_src(instr);
+ g_arch_instruction_lock_src(instr);
- count = g_arch_instruction_get_sources(instr, &sources);
+ count = g_arch_instruction_count_sources(instr);
result = PyTuple_New(count);
for (i = 0; i < count; i++)
{
- dest = pygobject_new(G_OBJECT(sources[i].linked));
- type = PyLong_FromLong(sources[i].type);
+ source = g_arch_instruction_get_source(instr, i);
- ret = PyTuple_SetItem(result, i, Py_BuildValue("(OO)", dest, type));
+ linked = pygobject_new(G_OBJECT(source->linked));
+ type = PyLong_FromLong(source->type);
+
+ ret = PyTuple_SetItem(result, i, Py_BuildValue("(OO)", linked, type));
assert(ret == 0);
}
- g_arch_instruction_runlock_src(instr);
+ g_arch_instruction_unlock_src(instr);
return result;
@@ -155,32 +157,34 @@ static PyObject *py_arch_instruction_get_destinations(PyObject *self, void *unus
{
PyObject *result; /* Instance à retourner */
GArchInstruction *instr; /* Version native */
- instr_link_t *dests; /* Destination des liens */
+ instr_link_t *dest; /* Destination des liens */
size_t count; /* Nombre de liens présents */
size_t i; /* Boucle de parcours */
- PyObject *dest; /* Destination de lien Python */
+ PyObject *linked; /* Destination de lien Python */
PyObject *type; /* Nature du lien en Python */
int ret; /* Bilan d'une écriture d'arg. */
instr = G_ARCH_INSTRUCTION(pygobject_get(self));
- g_arch_instruction_rlock_dest(instr);
+ g_arch_instruction_lock_dest(instr);
- count = g_arch_instruction_get_destinations(instr, &dests);
+ count = g_arch_instruction_count_destinations(instr);
result = PyTuple_New(count);
for (i = 0; i < count; i++)
{
- dest = pygobject_new(G_OBJECT(dests[i].linked));
- type = PyLong_FromLong(dests[i].type);
+ dest = g_arch_instruction_get_destination(instr, i);
+
+ linked = pygobject_new(G_OBJECT(dest->linked));
+ type = PyLong_FromLong(dest->type);
- ret = PyTuple_SetItem(result, i, Py_BuildValue("(OO)", dest, type));
+ ret = PyTuple_SetItem(result, i, Py_BuildValue("(OO)", linked, type));
assert(ret == 0);
}
- g_arch_instruction_runlock_dest(instr);
+ g_arch_instruction_unlock_dest(instr);
return result;