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
sp = buffer;
mnem = insn->mnemonic;
if (mci->csh->arch == CS_ARCH_X86 && mci->x86_prefix[0]) {
for (sp = buffer; *sp; sp++) {
if (*sp == ' '|| *sp == '\t')
break;
if (*sp == '|') // lock|rep prefix for x86
*sp = ' ';
// copy to @mnemonic
*mnem = *sp;
mnem++;
}
} else {
for (sp = buffer; *sp; sp++) {
if (*sp == ' '|| *sp == '\t')
break;
// copy to @mnemonic
*mnem = *sp;
mnem++;
}
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';

Loading…
Cancel
Save