diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2017-01-08 20:03:20 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2017-01-08 20:03:20 (GMT) |
commit | 746a7cfb0b5f2db859618d2e490eafeb9047958b (patch) | |
tree | c82c0f0bcdfda0cb6c913b707f25a38d8fac1179 /src/arch | |
parent | 991445be8992c9aad1d86f1ce28300c3421e8f2c (diff) |
Fixed the behavior of the instruction iterator.
Diffstat (limited to 'src/arch')
-rw-r--r-- | src/arch/instriter.c | 18 |
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); |