mirror of
https://github.com/capstone-engine/capstone.git
synced 2025-02-12 01:45:48 +00:00
cleanup : move the initialization of m68k_info
Simplify the code by moving the initialization of printer_info (m68k_info) at the right place, in the module.init() function. Signed-off-by: Nicolas PLANEL <nplanel@gmail.com>
This commit is contained in:
parent
b9f66d63c9
commit
d1b5c3f384
@ -3868,18 +3868,7 @@ bool M68K_getInstruction(csh ud, const uint8_t* code, size_t code_len, MCInst* i
|
||||
int s;
|
||||
int cpu_type = M68K_CPU_TYPE_68000;
|
||||
cs_struct* handle = instr->csh;
|
||||
m68k_info *info;
|
||||
|
||||
if (handle->printer_info == NULL) {
|
||||
info = cs_mem_malloc(sizeof(m68k_info));
|
||||
if (!info) {
|
||||
handle->errnum = CS_ERR_MEM;
|
||||
return false;
|
||||
}
|
||||
handle->printer_info = info;
|
||||
} else {
|
||||
info = (m68k_info *)handle->printer_info;
|
||||
}
|
||||
m68k_info *info = (m68k_info *)handle->printer_info;
|
||||
|
||||
info->code = code;
|
||||
info->baseAddress = address;
|
||||
|
@ -10,8 +10,15 @@
|
||||
|
||||
static cs_err init(cs_struct *ud)
|
||||
{
|
||||
m68k_info *info;
|
||||
|
||||
info = cs_mem_malloc(sizeof(m68k_info));
|
||||
if (!info) {
|
||||
return CS_ERR_MEM;
|
||||
}
|
||||
|
||||
ud->printer = M68K_printInst;
|
||||
ud->printer_info = NULL;
|
||||
ud->printer_info = info;
|
||||
ud->getinsn_info = NULL;
|
||||
ud->disasm = M68K_getInstruction;
|
||||
ud->skipdata_size = 2;
|
||||
|
Loading…
x
Reference in New Issue
Block a user