core: C99 fix for cs_disasm_ex()
diff --git a/cs.c b/cs.c
index 435ecec..d3d037a 100644
--- a/cs.c
+++ b/cs.c
@@ -324,6 +324,7 @@
cs_insn insn_cache[INSN_CACHE_SIZE];
void *total = NULL;
size_t total_size = 0;
+ bool r;
if (!handle) {
// FIXME: how to handle this case:
@@ -342,7 +343,7 @@
MCInst_Init(&mci);
mci.csh = handle;
- bool r = handle->disasm(ud, buffer, size, &mci, &insn_size, offset, handle->getinsn_info);
+ r = handle->disasm(ud, buffer, size, &mci, &insn_size, offset, handle->getinsn_info);
if (r) {
SStream ss;
SStream_Init(&ss);
@@ -368,8 +369,10 @@
if (f == ARR_SIZE(insn_cache)) {
// resize total to contain newly disasm insns
+ void *tmp;
+
total_size += (sizeof(cs_insn) * INSN_CACHE_SIZE);
- void *tmp = cs_mem_realloc(total, total_size);
+ tmp = cs_mem_realloc(total, total_size);
if (tmp == NULL) { // insufficient memory
cs_mem_free(total);
handle->errnum = CS_ERR_MEM;