From 72744c287bcddd64e56a67ba5f489e81aa042d67 Mon Sep 17 00:00:00 2001 From: kabeor <1597915586@qq.com> Date: Wed, 5 Jan 2022 15:49:11 +0800 Subject: [PATCH] clean up code --- MCInst.c | 8 -------- cs.c | 28 ---------------------------- 2 files changed, 36 deletions(-) diff --git a/MCInst.c b/MCInst.c index 7b97ed00..c41be148 100644 --- a/MCInst.c +++ b/MCInst.c @@ -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; diff --git a/cs.c b/cs.c index f67ddcb5..d0400e70 100644 --- a/cs.c +++ b/cs.c @@ -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 }