summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/instriter.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/arch/instriter.c b/src/arch/instriter.c
index ef1d865..2c922d8 100644
--- a/src/arch/instriter.c
+++ b/src/arch/instriter.c
@@ -155,14 +155,15 @@ GArchInstruction *get_instruction_iterator_prev(instr_iter_t *iter)
else
{
- if (iter->index > 0)
+ if (iter->index > 1)
+ {
+ iter->index--;
result = g_arch_processor_get_instruction(iter->proc, iter->index);
+ }
+
else
result = NULL;
- if (result != NULL)
- iter->index--;
-
}
g_arch_processor_unlock(iter->proc);
@@ -195,14 +196,15 @@ GArchInstruction *get_instruction_iterator_next(instr_iter_t *iter)
else
{
- if (iter->index < g_arch_processor_count_instructions(iter->proc))
+ if ((iter->index + 1) < g_arch_processor_count_instructions(iter->proc))
+ {
+ iter->index++;
result = g_arch_processor_get_instruction(iter->proc, iter->index);
+ }
+
else
result = NULL;
- if (result != NULL)
- iter->index++;
-
}
g_arch_processor_unlock(iter->proc);