diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2016-10-28 22:26:53 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2016-10-28 22:26:53 (GMT) |
commit | 8c71b36d401b2473342daddcb9b7eb4b83ba3295 (patch) | |
tree | 13515f99f3e01fc2d1701189e500fa69763da7f9 /plugins/pychrysa | |
parent | 2c70e3332b43bdcbe215081b697395d254418e48 (diff) |
Optimized access to instruction sources and destinations.
Diffstat (limited to 'plugins/pychrysa')
-rw-r--r-- | plugins/pychrysa/arch/instruction.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/plugins/pychrysa/arch/instruction.c b/plugins/pychrysa/arch/instruction.c index ff3d2ad..f52b1ad 100644 --- a/plugins/pychrysa/arch/instruction.c +++ b/plugins/pychrysa/arch/instruction.c @@ -103,8 +103,7 @@ static PyObject *py_arch_instruction_get_sources(PyObject *self, PyObject *args) { PyObject *result; /* Instance à retourner */ GArchInstruction *instr; /* Version native */ - GArchInstruction **dests; /* Destination des liens */ - InstructionLinkType *types; /* Nature de ces liens */ + instr_link_t *sources; /* Origine des liens */ size_t count; /* Nombre de liens présents */ size_t i; /* Boucle de parcours */ PyObject *dest; /* Destination de lien Python */ @@ -113,14 +112,14 @@ static PyObject *py_arch_instruction_get_sources(PyObject *self, PyObject *args) instr = G_ARCH_INSTRUCTION(pygobject_get(self)); - count = g_arch_instruction_get_sources(instr, &dests, &types); + count = g_arch_instruction_get_sources(instr, &sources); result = PyTuple_New(count); for (i = 0; i < count; i++) { - dest = pygobject_new(G_OBJECT(dests[i])); - type = PyLong_FromLong(types[i]); + dest = pygobject_new(G_OBJECT(sources[i].linked)); + type = PyLong_FromLong(sources[i].type); ret = PyTuple_SetItem(result, i, Py_BuildValue("(OO)", dest, type)); assert(ret == 0); @@ -149,8 +148,7 @@ static PyObject *py_arch_instruction_get_destinations(PyObject *self, PyObject * { PyObject *result; /* Instance à retourner */ GArchInstruction *instr; /* Version native */ - GArchInstruction **dests; /* Destination des liens */ - InstructionLinkType *types; /* Nature de ces liens */ + instr_link_t *dests; /* Destination des liens */ size_t count; /* Nombre de liens présents */ size_t i; /* Boucle de parcours */ PyObject *dest; /* Destination de lien Python */ @@ -159,14 +157,14 @@ static PyObject *py_arch_instruction_get_destinations(PyObject *self, PyObject * instr = G_ARCH_INSTRUCTION(pygobject_get(self)); - count = g_arch_instruction_get_destinations(instr, &dests, &types); + count = g_arch_instruction_get_destinations(instr, &dests); result = PyTuple_New(count); for (i = 0; i < count; i++) { - dest = pygobject_new(G_OBJECT(dests[i])); - type = PyLong_FromLong(types[i]); + dest = pygobject_new(G_OBJECT(dests[i].linked)); + type = PyLong_FromLong(dests[i].type); ret = PyTuple_SetItem(result, i, Py_BuildValue("(OO)", dest, type)); assert(ret == 0); |