From d392f6ef89f258ea7c3a166131e08ae2c2ff99ef Mon Sep 17 00:00:00 2001 From: Nguyen Anh Quynh Date: Wed, 2 Jul 2014 12:22:39 +0800 Subject: [PATCH] simplify code copying @mnemonic in fill_insn() --- cs.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/cs.c b/cs.c index 7f9ecf84..a02de940 100644 --- a/cs.c +++ b/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';