tests: C89
diff --git a/tests/test_mips.c b/tests/test_mips.c
index fcbefa1..a58e405 100644
--- a/tests/test_mips.c
+++ b/tests/test_mips.c
@@ -31,6 +31,7 @@
static void print_insn_detail(cs_insn *ins)
{
+ int i;
cs_mips *mips;
// detail can be NULL on "data" instruction if SKIPDATA option is turned ON
@@ -41,7 +42,6 @@
if (mips->op_count)
printf("\top_count: %u\n", mips->op_count);
- int i;
for (i = 0; i < mips->op_count; i++) {
cs_mips_op *op = &(mips->operands[i]);
switch((int)op->type) {
@@ -101,6 +101,7 @@
uint64_t address = 0x1000;
cs_insn *insn;
int i;
+ size_t count;
for (i = 0; i < sizeof(platforms)/sizeof(platforms[0]); i++) {
cs_err err = cs_open(platforms[i].arch, platforms[i].mode, &handle);
@@ -111,14 +112,15 @@
cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON);
- size_t count = cs_disasm_ex(handle, platforms[i].code, platforms[i].size, address, 0, &insn);
+ count = cs_disasm_ex(handle, platforms[i].code, platforms[i].size, address, 0, &insn);
if (count) {
+ size_t j;
+
printf("****************\n");
printf("Platform: %s\n", platforms[i].comment);
print_string_hex("Code:", platforms[i].code, platforms[i].size);
printf("Disasm:\n");
- size_t j;
for (j = 0; j < count; j++) {
printf("0x%"PRIx64":\t%s\t%s\n", insn[j].address, insn[j].mnemonic, insn[j].op_str);
print_insn_detail(&insn[j]);