clean up code

This commit is contained in:
kabeor 2022-01-05 15:49:11 +08:00
parent dc091cb9e5
commit cecc6c1c10
2 changed files with 0 additions and 36 deletions

View File

@ -17,14 +17,6 @@
void MCInst_Init(MCInst *inst)
{
#if 0
// this loop consumes 2% of the whole disasm work
unsigned int i;
for (i = 0; i < 48; i++) {
inst->Operands[i].Kind = kInvalid;
inst->Operands[i].ImmVal = 0;
}
#endif
// unnecessary to initialize in loop . its expensive and inst->size shuold be honored
inst->Operands[0].Kind = kInvalid;
inst->Operands[0].ImmVal = 0;

28
cs.c
View File

@ -562,22 +562,6 @@ static void fill_insn(struct cs_struct *handle, cs_insn *insn, char *buffer, MCI
if (tab) {
strcpy (insn->op_str, tab + 1);
}
#if 0
// fill in mnemonic & operands
// find first space or tab
mnem = insn->mnemonic;
for (sp = buffer; *sp; sp++) {
if (*sp == ' '|| *sp == '\t')
break;
if (*sp == '|') // lock|rep prefix for x86
*sp = ' ';
// copy to @mnemonic
*mnem = *sp;
mnem++;
}
*mnem = '\0';
#endif
// we might have customized mnemonic
if (handle->mnem_list) {
@ -597,18 +581,6 @@ static void fill_insn(struct cs_struct *handle, cs_insn *insn, char *buffer, MCI
tmp = tmp->next;
}
}
#if 0
// copy @op_str
if (*sp) {
// find the next non-space char
sp++;
for (; ((*sp == ' ') || (*sp == '\t')); sp++);
strncpy(insn->op_str, sp, sizeof(insn->op_str) - 1);
insn->op_str[sizeof(insn->op_str) - 1] = '\0';
} else
insn->op_str[0] = '\0';
#endif
#endif
}