simplify code copying @mnemonic in fill_insn()

v2
Nguyen Anh Quynh 11 years ago
parent 22ea683583
commit d392f6ef89
  1. 26
      cs.c

26
cs.c

@ -278,24 +278,14 @@ static void fill_insn(struct cs_struct *handle, cs_insn *insn, char *buffer, MCI
// find first space or tab // find first space or tab
sp = buffer; sp = buffer;
mnem = insn->mnemonic; mnem = insn->mnemonic;
if (mci->csh->arch == CS_ARCH_X86 && mci->x86_prefix[0]) { for (sp = buffer; *sp; sp++) {
for (sp = buffer; *sp; sp++) { if (*sp == ' '|| *sp == '\t')
if (*sp == ' '|| *sp == '\t') break;
break; if (*sp == '|') // lock|rep prefix for x86
if (*sp == '|') // lock|rep prefix for x86 *sp = ' ';
*sp = ' '; // copy to @mnemonic
// copy to @mnemonic *mnem = *sp;
*mnem = *sp; mnem++;
mnem++;
}
} else {
for (sp = buffer; *sp; sp++) {
if (*sp == ' '|| *sp == '\t')
break;
// copy to @mnemonic
*mnem = *sp;
mnem++;
}
} }
*mnem = '\0'; *mnem = '\0';

Loading…
Cancel
Save