diff --git a/MCInst.c b/MCInst.c index d6f513ad..8ca3f8c2 100644 --- a/MCInst.c +++ b/MCInst.c @@ -27,21 +27,6 @@ void MCInst_clear(MCInst *inst) inst->size = 0; } -// NOTE: this will free @Op argument -void MCInst_insert(MCInst *inst, int index, MCOperand *Op) -{ - int i; - - for(i = inst->size; i > index; i--) - //memcpy(&(inst->Operands[i]), &(inst->Operands[i-1]), sizeof(MCOperand)); - inst->Operands[i] = inst->Operands[i-1]; - - inst->Operands[index] = *Op; - inst->size++; - - cs_mem_free(Op); -} - // do not free @Op void MCInst_insert0(MCInst *inst, int index, MCOperand *Op) { diff --git a/MCInst.h b/MCInst.h index e3371618..ab3945e4 100644 --- a/MCInst.h +++ b/MCInst.h @@ -115,9 +115,6 @@ void MCInst_Init(cs_struct *handle, MCInst *inst); void MCInst_clear(MCInst *inst); -// free operand after inserting -void MCInst_insert(MCInst *inst, int index, MCOperand *Op); - // do not free operand after inserting void MCInst_insert0(MCInst *inst, int index, MCOperand *Op); diff --git a/arch/PowerPC/PPCDisassembler.c b/arch/PowerPC/PPCDisassembler.c index 3fd2eae5..a7e63713 100644 --- a/arch/PowerPC/PPCDisassembler.c +++ b/arch/PowerPC/PPCDisassembler.c @@ -224,7 +224,7 @@ static DecodeStatus decodeMemRIOperands(MCInst *Inst, uint64_t Imm, case PPC_STWU: case PPC_STFSU: case PPC_STFDU: - MCInst_insert(Inst, 0, MCOperand_CreateReg(GP0Regs[Base])); + MCInst_insert0(Inst, 0, MCOperand_CreateReg1(Inst, GP0Regs[Base])); break; } @@ -248,7 +248,7 @@ static DecodeStatus decodeMemRIXOperands(MCInst *Inst, uint64_t Imm, // Add the tied output operand. MCOperand_CreateReg0(Inst, GP0Regs[Base]); else if (MCInst_getOpcode(Inst) == PPC_STDU) - MCInst_insert(Inst, 0, MCOperand_CreateReg(GP0Regs[Base])); + MCInst_insert0(Inst, 0, MCOperand_CreateReg1(Inst, GP0Regs[Base])); MCOperand_CreateImm0(Inst, SignExtend64(Disp << 2, 16)); MCOperand_CreateReg0(Inst, GP0Regs[Base]);