Skip to content

Commit

Permalink
Removed str_newf (#4164)
Browse files Browse the repository at this point in the history
  • Loading branch information
HN026 committed Jan 27, 2024
1 parent affbb32 commit 1743a81
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
9 changes: 4 additions & 5 deletions librz/asm/p/asm_sysz.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,15 @@ static int sysz_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len) {
if (n > 0) {
if (insn->size > 0) {
op->size = insn->size;
char *buf_asm = rz_str_newf("%s%s%s",
rz_asm_op_setf_asm(op, "%s%s%s",
insn->mnemonic, insn->op_str[0] ? " " : "",
insn->op_str);
if (buf_asm) {
char *ptrstr = strstr(buf_asm, "ptr ");
char *str = rz_asm_op_get_asm(op);
if (str) {
char *ptrstr = strstr(str, "ptr ");
if (ptrstr) {
memmove(ptrstr, ptrstr + 4, strlen(ptrstr + 4) + 1);
}
rz_asm_op_set_asm(op, buf_asm);
free(buf_asm);
}
}
cs_free(insn, n);
Expand Down
11 changes: 5 additions & 6 deletions librz/asm/p/asm_tms320.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ static int tms320c64x_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len
goto fin;
}
op->size = insn->size;
char *buf_asm = rz_str_newf("%s%s%s", insn->mnemonic, insn->op_str[0] ? " " : "", insn->op_str);
if (buf_asm) {
rz_str_replace_char(buf_asm, '%', 0);
rz_str_case(buf_asm, false);
rz_asm_op_set_asm(op, buf_asm);
free(buf_asm);
rz_asm_op_setf_asm(op, "%s%s%s", insn->mnemonic, insn->op_str[0] ? " " : "", insn->op_str);
char *str = rz_asm_op_get_asm(op);
if (str) {
rz_str_replace_char(str, '%', 0);
rz_str_case(str, false);
}
cs_free(insn, n);
fin:
Expand Down
11 changes: 5 additions & 6 deletions librz/asm/p/asm_tms320c64x.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,11 @@ static int tms320c64x_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len
goto fin;
}
op->size = insn->size;
char *buf_asm = rz_str_newf("%s%s%s", insn->mnemonic, insn->op_str[0] ? " " : "", insn->op_str);
if (buf_asm) {
rz_str_replace_char(buf_asm, '%', 0);
rz_str_case(buf_asm, false);
rz_asm_op_set_asm(op, buf_asm);
free(buf_asm);
rz_asm_op_setf_asm(op, "%s%s%s", insn->mnemonic, insn->op_str[0] ? " " : "", insn->op_str);
char *str = rz_asm_op_get_asm(op);
if (str) {
rz_str_replace_char(str, '%', 0);
rz_str_case(str, false);
}
cs_free(insn, n);
fin:
Expand Down

0 comments on commit 1743a81

Please sign in to comment.