move insn_cache into cs_struct to gurantee thread-safe
diff --git a/cs.c b/cs.c
index 8ee19fe..5e424d7 100644
--- a/cs.c
+++ b/cs.c
@@ -138,8 +138,7 @@
return CS_ERR_HANDLE;
}
- if (arch_destroy[ud->arch])
- arch_destroy[ud->arch](ud);
+ arch_destroy[ud->arch](ud);
memset(ud, 0, sizeof(*ud));
my_free(ud);
@@ -174,7 +173,7 @@
// map internal instruction opcode to public insn ID
if (handle->insn_id)
- handle->insn_id(insn, MCInst_getOpcode(mci), handle->detail);
+ handle->insn_id(handle, insn, MCInst_getOpcode(mci));
// alias instruction might have ID saved in OpcodePub
if (MCInst_getOpcodePub(mci))