Replace strdup with rz_str_dup (#4634)
This commit is contained in:
parent
ae644fe03e
commit
db1e4993a0
409 changed files with 2181 additions and 2180 deletions
|
|
@ -29,8 +29,8 @@ RZ_API void rz_asm_equ_item_free(RzAsmEqu *equ) {
|
|||
static RzAsmEqu *__asm_equ_new(const char *key, const char *value) {
|
||||
RzAsmEqu *equ = RZ_NEW0(RzAsmEqu);
|
||||
if (equ) {
|
||||
equ->key = strdup(key);
|
||||
equ->value = strdup(value);
|
||||
equ->key = rz_str_dup(key);
|
||||
equ->value = rz_str_dup(value);
|
||||
}
|
||||
return equ;
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ RZ_API bool rz_asm_code_set_equ(RzAsmCode *code, const char *key, const char *va
|
|||
rz_list_foreach (code->equs, iter, equ) {
|
||||
if (!strcmp(equ->key, key)) {
|
||||
free(equ->value);
|
||||
equ->value = strdup(value);
|
||||
equ->value = rz_str_dup(value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ RZ_API RzAnalysis *rz_analysis_new(void) {
|
|||
analysis->bb_tree = NULL;
|
||||
analysis->ht_addr_fun = ht_up_new(NULL, NULL);
|
||||
analysis->ht_name_fun = ht_sp_new(HT_STR_DUP, NULL, NULL);
|
||||
analysis->os = strdup(RZ_SYS_OS);
|
||||
analysis->os = rz_str_dup(RZ_SYS_OS);
|
||||
analysis->esil_goto_limit = RZ_ANALYSIS_ESIL_GOTO_LIMIT;
|
||||
analysis->opt.nopskip = true; // skip nops in code analysis
|
||||
analysis->opt.hpskip = false; // skip `mov reg,reg` and `lea reg,[reg]`
|
||||
|
|
@ -286,7 +286,7 @@ static bool analysis_set_os(RzAnalysis *analysis, const char *os) {
|
|||
os = RZ_SYS_OS;
|
||||
}
|
||||
free(analysis->os);
|
||||
analysis->os = strdup(os);
|
||||
analysis->os = rz_str_dup(os);
|
||||
char *types_dir = rz_path_system(RZ_SDB_TYPES);
|
||||
rz_type_db_set_os(analysis->typedb, os);
|
||||
rz_type_db_reload(analysis->typedb, types_dir);
|
||||
|
|
@ -367,7 +367,7 @@ RZ_API void rz_analysis_set_cpu(RzAnalysis *analysis, const char *cpu) {
|
|||
return;
|
||||
}
|
||||
free(analysis->cpu);
|
||||
analysis->cpu = cpu ? strdup(cpu) : NULL;
|
||||
analysis->cpu = rz_str_dup(cpu);
|
||||
int v = rz_analysis_archinfo(analysis, RZ_ANALYSIS_ARCHINFO_TEXT_ALIGN);
|
||||
if (v != -1) {
|
||||
analysis->pcalign = v;
|
||||
|
|
@ -612,7 +612,7 @@ RZ_API bool rz_analysis_noreturn_add(RzAnalysis *analysis, const char *name, ut6
|
|||
}
|
||||
}
|
||||
if (rz_type_func_exist(analysis->typedb, tmp_name)) {
|
||||
fnl_name = strdup(tmp_name);
|
||||
fnl_name = rz_str_dup(tmp_name);
|
||||
} else if (!(fnl_name = rz_analysis_function_name_guess(analysis->typedb, (char *)tmp_name))) {
|
||||
if (addr == UT64_MAX) {
|
||||
if (name) {
|
||||
|
|
@ -816,7 +816,7 @@ RZ_API void rz_analysis_add_import(RzAnalysis *analysis, const char *imp) {
|
|||
return;
|
||||
}
|
||||
}
|
||||
char *cimp = strdup(imp);
|
||||
char *cimp = rz_str_dup(imp);
|
||||
if (!cimp) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -503,7 +503,7 @@ RZ_API bool rz_asm_use(RzAsm *a, const char *name) {
|
|||
RZ_DEPRECATE RZ_API void rz_asm_set_cpu(RzAsm *a, const char *cpu) {
|
||||
if (a) {
|
||||
free(a->cpu);
|
||||
a->cpu = cpu ? strdup(cpu) : NULL;
|
||||
a->cpu = rz_str_dup(cpu);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -725,7 +725,7 @@ RZ_API void rz_asm_list_directives(void) {
|
|||
RZ_API int rz_asm_assemble(RzAsm *a, RzAsmOp *op, const char *buf) {
|
||||
rz_return_val_if_fail(a && op && buf, 0);
|
||||
int ret = 0;
|
||||
char *b = strdup(buf);
|
||||
char *b = rz_str_dup(buf);
|
||||
if (!b) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -871,7 +871,7 @@ RZ_API RzAsmCode *rz_asm_massemble(RzAsm *a, const char *assembly) {
|
|||
free(tokens);
|
||||
return rz_asm_code_free(acode);
|
||||
}
|
||||
lbuf = strdup(assembly);
|
||||
lbuf = rz_str_dup(assembly);
|
||||
acode->code_align = 0;
|
||||
|
||||
/* consider ,, an alias for a newline */
|
||||
|
|
@ -900,7 +900,7 @@ RZ_API RzAsmCode *rz_asm_massemble(RzAsm *a, const char *assembly) {
|
|||
if (sp) {
|
||||
char osp = *sp;
|
||||
*sp = 0;
|
||||
aa = strdup(p);
|
||||
aa = rz_str_dup(p);
|
||||
*sp = osp;
|
||||
num = rz_syscall_get_num(a->syscall, aa + 5);
|
||||
snprintf(val, sizeof(val), "%d", num);
|
||||
|
|
@ -1022,7 +1022,7 @@ RZ_API RzAsmCode *rz_asm_massemble(RzAsm *a, const char *assembly) {
|
|||
// if (stage != 2) {
|
||||
if (ptr_start[1] && ptr_start[1] != ' ') {
|
||||
*ptr = 0;
|
||||
char *p = strdup(ptr_start);
|
||||
char *p = rz_str_dup(ptr_start);
|
||||
*ptr = ':';
|
||||
if (acode->code_align) {
|
||||
off += (acode->code_align - (off % acode->code_align));
|
||||
|
|
@ -1060,7 +1060,7 @@ RZ_API RzAsmCode *rz_asm_massemble(RzAsm *a, const char *assembly) {
|
|||
ret = rz_asm_pseudo_string(&op, ptr + 8, 1);
|
||||
} else if (!strncmp(ptr, ".string ", 8)) {
|
||||
rz_str_trim(ptr + 8);
|
||||
char *str = strdup(ptr + 8);
|
||||
char *str = rz_str_dup(ptr + 8);
|
||||
ret = rz_asm_pseudo_string(&op, str, 1);
|
||||
free(str);
|
||||
} else if (!strncmp(ptr, ".ascii", 6)) {
|
||||
|
|
@ -1151,7 +1151,7 @@ RZ_API RzAsmCode *rz_asm_massemble(RzAsm *a, const char *assembly) {
|
|||
if (!*ptr_start) {
|
||||
continue;
|
||||
}
|
||||
str = rz_asm_code_equ_replace(acode, strdup(ptr_start));
|
||||
str = rz_asm_code_equ_replace(acode, rz_str_dup(ptr_start));
|
||||
rz_asm_op_fini(&op);
|
||||
rz_asm_op_init(&op);
|
||||
ret = rz_asm_assemble(a, &op, str);
|
||||
|
|
@ -1293,7 +1293,7 @@ RZ_API int rz_asm_mnemonics_byname(RzAsm *a, const char *name) {
|
|||
|
||||
RZ_API RzAsmCode *rz_asm_rasm_assemble(RzAsm *a, const char *buf, bool use_spp) {
|
||||
rz_return_val_if_fail(a && buf, NULL);
|
||||
char *lbuf = strdup(buf);
|
||||
char *lbuf = rz_str_dup(buf);
|
||||
if (!lbuf) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1309,7 +1309,7 @@ RZ_API RzAsmCode *rz_asm_rasm_assemble(RzAsm *a, const char *buf, bool use_spp)
|
|||
lbuf = replace_directives(lbuf);
|
||||
spp_eval(lbuf, &out);
|
||||
free(lbuf);
|
||||
lbuf = strdup(rz_strbuf_get(out.cout));
|
||||
lbuf = rz_str_dup(rz_strbuf_get(out.cout));
|
||||
}
|
||||
acode = rz_asm_massemble(a, lbuf);
|
||||
free(lbuf);
|
||||
|
|
|
|||
|
|
@ -36,14 +36,14 @@ RZ_API void rz_analysis_cc_del(RzAnalysis *analysis, const char *name) {
|
|||
|
||||
RZ_API bool rz_analysis_cc_set(RzAnalysis *analysis, const char *expr) {
|
||||
rz_return_val_if_fail(analysis && expr, false);
|
||||
char *e = strdup(expr);
|
||||
char *e = rz_str_dup(expr);
|
||||
char *p = strchr(e, '(');
|
||||
if (!p) {
|
||||
free(e);
|
||||
return false;
|
||||
}
|
||||
*p++ = 0;
|
||||
char *args = strdup(p);
|
||||
char *args = rz_str_dup(p);
|
||||
rz_str_trim(p);
|
||||
char *end = strchr(args, ')');
|
||||
if (!end) {
|
||||
|
|
@ -275,7 +275,7 @@ RZ_API RzList /*<char *>*/ *rz_analysis_calling_conventions(RzAnalysis *analysis
|
|||
RzPVector *items = sdb_get_items_filter(analysis->sdb_cc, filter_cc, NULL, true);
|
||||
rz_pvector_foreach (items, iter) {
|
||||
SdbKv *kv = *iter;
|
||||
rz_list_append(ccl, strdup(sdbkv_key(kv)));
|
||||
rz_list_append(ccl, rz_str_dup(sdbkv_key(kv)));
|
||||
}
|
||||
rz_pvector_free(items);
|
||||
return ccl;
|
||||
|
|
|
|||
|
|
@ -907,7 +907,7 @@ RZ_API RzAnalysisClassErr rz_analysis_class_base_get(RzAnalysis *analysis, const
|
|||
char *next;
|
||||
sdb_anext(cur, &next);
|
||||
|
||||
base->class_name = strdup(cur);
|
||||
base->class_name = rz_str_dup(cur);
|
||||
if (!base->class_name) {
|
||||
free(content);
|
||||
return RZ_ANALYSIS_CLASS_ERR_OTHER;
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ RZ_API char *rz_analysis_cond_to_string(RzAnalysisCond *cond) {
|
|||
}
|
||||
free(val0);
|
||||
free(val1);
|
||||
return out ? out : strdup("?");
|
||||
return out ? out : rz_str_dup("?");
|
||||
}
|
||||
|
||||
RZ_API RzAnalysisCond *rz_analysis_cond_new_from_op(RzAnalysisOp *op) {
|
||||
|
|
|
|||
|
|
@ -2009,7 +2009,7 @@ static bool RzAnalysisDwarfVariable_as_RzAnalysisVar(RzAnalysis *a, RzAnalysisFu
|
|||
return false;
|
||||
}
|
||||
var->type = DW_var->type ? rz_type_clone(DW_var->type) : rz_type_new_default(a->typedb);
|
||||
var->name = strdup(DW_var->prefer_name ? DW_var->prefer_name : "");
|
||||
var->name = rz_str_dup(DW_var->prefer_name ? DW_var->prefer_name : "");
|
||||
var->kind = DW_var->kind;
|
||||
var->fcn = f;
|
||||
var->origin.kind = RZ_ANALYSIS_VAR_ORIGIN_DWARF;
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ RZ_API bool rz_analysis_esil_push(RzAnalysisEsil *esil, const char *str) {
|
|||
if (!str || !esil || !*str || esil->stackptr > (esil->stacksize - 1)) {
|
||||
return false;
|
||||
}
|
||||
esil->stack[esil->stackptr++] = strdup(str);
|
||||
esil->stack[esil->stackptr++] = rz_str_dup(str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -790,7 +790,7 @@ static RzAnalysisBBEndCause run_basic_block_analysis(RzAnalysisTaskItem *item, R
|
|||
const char *name = analysis->coreb.getName(analysis->coreb.core, at);
|
||||
if (name) {
|
||||
if (rz_str_startswith(name, "try.") && rz_str_endswith(name, ".from")) {
|
||||
char *handle = strdup(name);
|
||||
char *handle = rz_str_dup(name);
|
||||
// handle = rz_str_replace (handle, ".from", ".to", 0);
|
||||
ut64 from_addr = analysis->coreb.numGet(analysis->coreb.core, handle);
|
||||
handle = rz_str_replace(handle, ".from", ".catch", 0);
|
||||
|
|
@ -910,7 +910,7 @@ static RzAnalysisBBEndCause run_basic_block_analysis(RzAnalysisTaskItem *item, R
|
|||
// Is this a mov of immediate value into a register?
|
||||
if (op.dst && op.dst->reg && op.dst->reg->name && op.val > 0 && op.val != UT64_MAX) {
|
||||
free(last_reg_mov_lea_name);
|
||||
if ((last_reg_mov_lea_name = strdup(op.dst->reg->name))) {
|
||||
if ((last_reg_mov_lea_name = rz_str_dup(op.dst->reg->name))) {
|
||||
last_reg_mov_lea_val = op.val;
|
||||
last_is_reg_mov_lea = true;
|
||||
}
|
||||
|
|
@ -921,7 +921,7 @@ static RzAnalysisBBEndCause run_basic_block_analysis(RzAnalysisTaskItem *item, R
|
|||
movscale = op.scale;
|
||||
if (op.src[0] && op.src[0]->reg) {
|
||||
free(movbasereg);
|
||||
movbasereg = strdup(op.src[0]->reg->name);
|
||||
movbasereg = rz_str_dup(op.src[0]->reg->name);
|
||||
} else {
|
||||
RZ_FREE(movbasereg);
|
||||
}
|
||||
|
|
@ -948,9 +948,9 @@ static RzAnalysisBBEndCause run_basic_block_analysis(RzAnalysisTaskItem *item, R
|
|||
pair->op_addr = op.addr;
|
||||
pair->leaddr = op.ptr; // XXX movdisp is dupped but seems to be trashed sometimes(?), better track leaddr separately
|
||||
pair->reg = op.reg
|
||||
? strdup(op.reg)
|
||||
? rz_str_dup(op.reg)
|
||||
: op.dst && op.dst->reg
|
||||
? strdup(op.dst->reg->name)
|
||||
? rz_str_dup(op.dst->reg->name)
|
||||
: NULL;
|
||||
rz_list_append(analysis->leaddrs, pair);
|
||||
}
|
||||
|
|
@ -959,7 +959,7 @@ static RzAnalysisBBEndCause run_basic_block_analysis(RzAnalysisTaskItem *item, R
|
|||
}
|
||||
if (op.dst && op.dst->reg && op.dst->reg->name && op.ptr > 0 && op.ptr != UT64_MAX) {
|
||||
free(last_reg_mov_lea_name);
|
||||
if ((last_reg_mov_lea_name = strdup(op.dst->reg->name))) {
|
||||
if ((last_reg_mov_lea_name = rz_str_dup(op.dst->reg->name))) {
|
||||
last_reg_mov_lea_val = op.ptr;
|
||||
last_is_reg_mov_lea = true;
|
||||
}
|
||||
|
|
@ -2605,7 +2605,7 @@ RZ_API RZ_OWN RzCallable *rz_analysis_function_clone_type(RzAnalysis *analysis,
|
|||
// Check first if there is a match with some pre-existing RzCallable type in the database
|
||||
char *shortname = rz_analysis_function_name_guess(analysis->typedb, f->name);
|
||||
if (!shortname) {
|
||||
shortname = strdup(f->name);
|
||||
shortname = rz_str_dup(f->name);
|
||||
}
|
||||
// At this point the `callable` pointer is *borrowed*
|
||||
RzCallable *callable = rz_type_func_get(analysis->typedb, shortname);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ static char *findEnd(const char *s) {
|
|||
s++;
|
||||
// also skip ansi escape codes here :?
|
||||
}
|
||||
return strdup(s);
|
||||
return rz_str_dup(s);
|
||||
}
|
||||
|
||||
static void insert(char *dst, const char *src) {
|
||||
|
|
@ -130,7 +130,7 @@ static void __replaceRegisters(RzReg *reg, char *s, bool x86) {
|
|||
}
|
||||
if (x86 && *k == 'r') {
|
||||
replaceWords(s, k, v);
|
||||
char *reg32 = strdup(k);
|
||||
char *reg32 = rz_str_dup(k);
|
||||
*reg32 = 'e';
|
||||
replaceWords(s, reg32, v);
|
||||
} else {
|
||||
|
|
@ -576,7 +576,7 @@ RZ_API bool rz_parse_filter(RzParse *p, ut64 addr, RzFlag *f, RzAnalysisHint *hi
|
|||
// easier to use, should replace rz_parse_filter(), but its not using rflag, analhint, endian, etc
|
||||
RZ_API char *rz_parse_filter_dup(RzParse *p, ut64 addr, const char *opstr) {
|
||||
const size_t out_len = 256;
|
||||
char *in = strdup(opstr);
|
||||
char *in = rz_str_dup(opstr);
|
||||
char *out = calloc(out_len, 1);
|
||||
if (!rz_parse_filter(p, addr, NULL, NULL, in, out, out_len, false)) {
|
||||
free(out);
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ RZ_API RzAnalysisFunction *rz_analysis_create_function(RzAnalysis *analysis, con
|
|||
fcn->bits = analysis->bits;
|
||||
if (name) {
|
||||
free(fcn->name);
|
||||
fcn->name = strdup(name);
|
||||
fcn->name = rz_str_dup(name);
|
||||
} else {
|
||||
const char *fcnprefix = analysis->coreb.cfgGet ? analysis->coreb.cfgGet(analysis->coreb.core, "analysis.fcnprefix") : NULL;
|
||||
if (RZ_STR_ISEMPTY(fcnprefix)) {
|
||||
|
|
@ -268,7 +268,7 @@ RZ_API bool rz_analysis_function_rename(RzAnalysisFunction *fcn, const char *nam
|
|||
}
|
||||
return false;
|
||||
}
|
||||
char *newname = strdup(name);
|
||||
char *newname = rz_str_dup(name);
|
||||
if (!newname) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -409,7 +409,7 @@ static RZ_OWN char *function_name_try_guess(RzTypeDB *typedb, RZ_NONNULL char *n
|
|||
return NULL;
|
||||
}
|
||||
if (rz_type_func_exist(typedb, name)) {
|
||||
return strdup(name);
|
||||
return rz_str_dup(name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -495,7 +495,7 @@ RZ_API RZ_OWN char *rz_analysis_function_name_guess(RzTypeDB *typedb, RZ_NONNULL
|
|||
return result;
|
||||
}
|
||||
|
||||
str = strdup(str);
|
||||
str = rz_str_dup(str);
|
||||
clean_function_name(str);
|
||||
|
||||
if (*str == '_' && (result = function_name_try_guess(typedb, str + 1))) {
|
||||
|
|
|
|||
|
|
@ -199,7 +199,7 @@ static RzAnalysisRangedHintRecordBase *ensure_ranged_hint_record(RBTree *tree, u
|
|||
RZ_API void rz_analysis_hint_set_offset(RzAnalysis *a, ut64 addr, const char *typeoff) {
|
||||
SET_HINT(RZ_ANALYSIS_ADDR_HINT_TYPE_TYPE_OFFSET,
|
||||
free(r->type_offset);
|
||||
r->type_offset = strdup(typeoff););
|
||||
r->type_offset = rz_str_dup(typeoff););
|
||||
}
|
||||
|
||||
RZ_API void rz_analysis_hint_set_nword(RzAnalysis *a, ut64 addr, int nword) {
|
||||
|
|
@ -241,19 +241,19 @@ RZ_API void rz_analysis_hint_set_ret(RzAnalysis *a, ut64 addr, ut64 val) {
|
|||
RZ_API void rz_analysis_hint_set_syntax(RzAnalysis *a, ut64 addr, const char *syn) {
|
||||
SET_HINT(RZ_ANALYSIS_ADDR_HINT_TYPE_SYNTAX,
|
||||
free(r->syntax);
|
||||
r->syntax = strdup(syn););
|
||||
r->syntax = rz_str_dup(syn););
|
||||
}
|
||||
|
||||
RZ_API void rz_analysis_hint_set_opcode(RzAnalysis *a, ut64 addr, const char *opcode) {
|
||||
SET_HINT(RZ_ANALYSIS_ADDR_HINT_TYPE_OPCODE,
|
||||
free(r->opcode);
|
||||
r->opcode = strdup(opcode););
|
||||
r->opcode = rz_str_dup(opcode););
|
||||
}
|
||||
|
||||
RZ_API void rz_analysis_hint_set_esil(RzAnalysis *a, ut64 addr, const char *esil) {
|
||||
SET_HINT(RZ_ANALYSIS_ADDR_HINT_TYPE_ESIL,
|
||||
free(r->esil);
|
||||
r->esil = strdup(esil););
|
||||
r->esil = rz_str_dup(esil););
|
||||
}
|
||||
|
||||
RZ_API void rz_analysis_hint_set_type(RzAnalysis *a, ut64 addr, int type) {
|
||||
|
|
@ -278,7 +278,7 @@ RZ_API void rz_analysis_hint_set_arch(RzAnalysis *a, ut64 addr, RZ_NULLABLE cons
|
|||
return;
|
||||
}
|
||||
free(record->arch);
|
||||
record->arch = arch ? strdup(arch) : NULL;
|
||||
record->arch = rz_str_dup(arch);
|
||||
}
|
||||
|
||||
RZ_API void rz_analysis_hint_set_bits(RzAnalysis *a, ut64 addr, int bits) {
|
||||
|
|
@ -476,19 +476,19 @@ static void hint_merge(RzAnalysisHint *hint, RzAnalysisAddrHintRecord *record) {
|
|||
hint->size = record->size;
|
||||
break;
|
||||
case RZ_ANALYSIS_ADDR_HINT_TYPE_SYNTAX:
|
||||
hint->syntax = record->syntax ? strdup(record->syntax) : NULL;
|
||||
hint->syntax = rz_str_dup(record->syntax);
|
||||
break;
|
||||
case RZ_ANALYSIS_ADDR_HINT_TYPE_OPTYPE:
|
||||
hint->type = record->optype;
|
||||
break;
|
||||
case RZ_ANALYSIS_ADDR_HINT_TYPE_OPCODE:
|
||||
hint->opcode = record->opcode ? strdup(record->opcode) : NULL;
|
||||
hint->opcode = rz_str_dup(record->opcode);
|
||||
break;
|
||||
case RZ_ANALYSIS_ADDR_HINT_TYPE_TYPE_OFFSET:
|
||||
hint->offset = record->type_offset ? strdup(record->type_offset) : NULL;
|
||||
hint->offset = rz_str_dup(record->type_offset);
|
||||
break;
|
||||
case RZ_ANALYSIS_ADDR_HINT_TYPE_ESIL:
|
||||
hint->esil = record->esil ? strdup(record->esil) : NULL;
|
||||
hint->esil = rz_str_dup(record->esil);
|
||||
break;
|
||||
case RZ_ANALYSIS_ADDR_HINT_TYPE_HIGH:
|
||||
hint->high = true;
|
||||
|
|
@ -518,7 +518,7 @@ RZ_API RzAnalysisHint *rz_analysis_hint_get(RzAnalysis *a, ut64 addr) {
|
|||
}
|
||||
}
|
||||
const char *arch = rz_analysis_hint_arch_at(a, addr, NULL);
|
||||
hint->arch = arch ? strdup(arch) : NULL;
|
||||
hint->arch = rz_str_dup(arch);
|
||||
hint->bits = rz_analysis_hint_bits_at(a, addr, NULL);
|
||||
if ((!records || rz_vector_empty(records)) && !hint->arch && !hint->bits) {
|
||||
// no hints found
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ char *rz_8051_disas(ut64 pc, const ut8 *buf, int len, int *olen) {
|
|||
}
|
||||
} else {
|
||||
*olen = -1;
|
||||
return strdup("truncated");
|
||||
return rz_str_dup("truncated");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
|
|
@ -159,7 +159,7 @@ char *rz_8051_disas(ut64 pc, const ut8 *buf, int len, int *olen) {
|
|||
}
|
||||
} else {
|
||||
*olen = -1;
|
||||
return strdup("truncated");
|
||||
return rz_str_dup("truncated");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -889,7 +889,7 @@ static ut32 thumb_getshift(const char *str) {
|
|||
const char *shifts[] = {
|
||||
"LSL", "LSR", "ASR", "ROR", 0, "RRX"
|
||||
};
|
||||
char *type = strdup(str);
|
||||
char *type = rz_str_dup(str);
|
||||
char *arg;
|
||||
char *space;
|
||||
ut32 res = 0;
|
||||
|
|
@ -914,7 +914,7 @@ static ut32 thumb_getshift(const char *str) {
|
|||
return 0;
|
||||
}
|
||||
*space = 0;
|
||||
arg = strdup(++space);
|
||||
arg = rz_str_dup(++space);
|
||||
|
||||
for (i = 0; shifts[i]; i++) {
|
||||
if (!strcmp(type, shifts[i])) {
|
||||
|
|
|
|||
|
|
@ -1007,7 +1007,7 @@ static ut32 bitfield(ArmOp *op, int k) {
|
|||
}
|
||||
|
||||
static bool parseOperands(char *str, ArmOp *op) {
|
||||
char *t = strdup(str);
|
||||
char *t = rz_str_dup(str);
|
||||
int operand = 0;
|
||||
char *token = t;
|
||||
char *x;
|
||||
|
|
@ -1294,7 +1294,7 @@ static bool parseOperands(char *str, ArmOp *op) {
|
|||
}
|
||||
|
||||
static bool parseOpcode(const char *str, ArmOp *op) {
|
||||
char *in = strdup(str);
|
||||
char *in = rz_str_dup(str);
|
||||
char *space = strchr(in, ' ');
|
||||
if (!space) {
|
||||
op->operands[0].type = ARM_NOTYPE;
|
||||
|
|
|
|||
|
|
@ -991,7 +991,7 @@ static void sanitize_input(char *cinput, st32 input_size) {
|
|||
|
||||
static char **tokens_new(cchar *input, st32 input_size, ut32 *ntokens) {
|
||||
|
||||
char *cinput = strdup(input);
|
||||
char *cinput = rz_str_dup(input);
|
||||
if (!cinput) {
|
||||
rz_warn_if_reached();
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ int lua53_anal_op(RzAnalysis *anal, RzAnalysisOp *op, ut64 addr, const ut8 *data
|
|||
if (GET_OPCODE(instruction) > OP_EXTRAARG) {
|
||||
return op->size;
|
||||
}
|
||||
// op->mnemonic = strdup ();
|
||||
// op->mnemonic = rz_str_dup ();
|
||||
|
||||
switch (GET_OPCODE(instruction)) {
|
||||
case OP_MOVE: /* A B R(A) := R(B) */
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ static int getreg(const char *p) {
|
|||
RZ_IPI int mips_assemble_opcode(const char *str, ut64 pc, ut8 *out) {
|
||||
int i, hasp;
|
||||
char w0[32], w1[32], w2[32], w3[32];
|
||||
char *s = strdup(str);
|
||||
char *s = rz_str_dup(str);
|
||||
if (!s) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -170,7 +170,7 @@ RZ_IPI int mips_assemble_opcode(const char *str, ut64 pc, ut8 *out) {
|
|||
if (arg) {
|
||||
snprintf(opstr, sizeof(opstr), "jalr ra ra %s", arg + 1);
|
||||
free(s);
|
||||
s = strdup(opstr);
|
||||
s = rz_str_dup(opstr);
|
||||
if (!s) {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,5 +208,5 @@ char *pic16_get_reg_profile(RzAnalysis *a) {
|
|||
"gpr tosh .8 25 0\n"
|
||||
"gpr tris .8 26 0\n"
|
||||
"gpr _bank .8 27 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -403,5 +403,5 @@ char *pic18_get_reg_profile(RzAnalysis *esil) {
|
|||
"gpr wregs .8 101 0\n"
|
||||
"gpr statuss .8 102 0\n"
|
||||
"gpr bsrs .8 103 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ void add_arg_fmt(pyc_opcodes *ret, char *op_name, const char *(*formatter)(ut32
|
|||
|
||||
void(def_opN)(struct op_parameter par) {
|
||||
free(par.op_obj[par.op_code].op_name);
|
||||
par.op_obj[par.op_code].op_name = strdup(par.op_name);
|
||||
par.op_obj[par.op_code].op_name = rz_str_dup(par.op_name);
|
||||
par.op_obj[par.op_code].op_code = par.op_code;
|
||||
par.op_obj[par.op_code].op_pop = par.pop;
|
||||
par.op_obj[par.op_code].op_push = par.push;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ static SHAddrMode sh_pb_get_addrmode(SHParamBuilder pb) {
|
|||
* \return char* Duplicated output "spaced out" string
|
||||
*/
|
||||
static char *sh_op_space_params(const char *buffer) {
|
||||
char *spaced = strdup(buffer);
|
||||
char *spaced = rz_str_dup(buffer);
|
||||
bool inside_paren = false;
|
||||
|
||||
for (ut8 i = 0; spaced[i] != '\0'; i++) {
|
||||
|
|
@ -87,9 +87,9 @@ static ut32 sh_op_param_bits(SHParamBuilder shb, const char *param, SHScaling sc
|
|||
|
||||
ut32 opcode = 0;
|
||||
struct sh_param_builder_addr_t shba = shb.addr;
|
||||
char *const reg = strdup(param);
|
||||
char *const dup = strdup(param);
|
||||
char *const disp = strdup(param);
|
||||
char *const reg = rz_str_dup(param);
|
||||
char *const dup = rz_str_dup(param);
|
||||
char *const disp = rz_str_dup(param);
|
||||
ut8 d;
|
||||
|
||||
switch (shba.mode) {
|
||||
|
|
@ -209,7 +209,7 @@ static ut32 sh_op_param_bits(SHParamBuilder shb, const char *param, SHScaling sc
|
|||
static ut64 sh_op_movl_param_bits(const char *reg_direct, const char *reg_disp_indirect) {
|
||||
ut64 opcode = sh_op_reg_bits(reg_direct, NIB1);
|
||||
|
||||
char *const dup = strdup(reg_disp_indirect);
|
||||
char *const dup = rz_str_dup(reg_disp_indirect);
|
||||
char *comma = strchr(dup, ',');
|
||||
if (!comma) {
|
||||
goto fail;
|
||||
|
|
@ -222,7 +222,7 @@ static ut64 sh_op_movl_param_bits(const char *reg_direct, const char *reg_disp_i
|
|||
}
|
||||
*paren = '\0';
|
||||
|
||||
char *const disp = strdup(reg_disp_indirect);
|
||||
char *const disp = rz_str_dup(reg_disp_indirect);
|
||||
sscanf(dup, "@(%s", disp);
|
||||
ut8 d = (rz_num_get(NULL, disp) / sh_scaling_size[SH_SCALING_L]) & 0xf;
|
||||
opcode |= d << NIB0;
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ static char *decode_regis(char *reg_arg, st32 hash_code, ut32 ins_bits,
|
|||
*err_code = -1;
|
||||
return NULL;
|
||||
}
|
||||
res = (check_arg(ins_bits, err_code) != 0 && *err_code == 0) ? strdup("dbl(") : NULL;
|
||||
res = (check_arg(ins_bits, err_code) != 0 && *err_code == 0) ? rz_str_dup("dbl(") : NULL;
|
||||
if (*err_code < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -147,7 +147,7 @@ static char *decode_regis(char *reg_arg, st32 hash_code, ut32 ins_bits,
|
|||
*err_code = -1;
|
||||
return NULL;
|
||||
}
|
||||
res = (check_arg(ins_bits, err_code) && *err_code == 0) ? strdup(")") : NULL;
|
||||
res = (check_arg(ins_bits, err_code) && *err_code == 0) ? rz_str_dup(")") : NULL;
|
||||
if (*err_code < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -553,7 +553,7 @@ static char *get_token_decoded(st32 hash_code, char *ins_token, ut32 ins_token_l
|
|||
case 64:
|
||||
case 65:
|
||||
if (!reg_arg || *reg_arg == '\0') {
|
||||
res = strdup("<register>");
|
||||
res = rz_str_dup("<register>");
|
||||
goto ret_decode;
|
||||
}
|
||||
res = decode_regis(reg_arg, hash_code, ins_bits, ret_ins_bits, err_code);
|
||||
|
|
@ -561,18 +561,18 @@ static char *get_token_decoded(st32 hash_code, char *ins_token, ut32 ins_token_l
|
|||
return NULL;
|
||||
}
|
||||
break;
|
||||
case 35: res = ins_bits ? strdup(" || far()") : NULL; break;
|
||||
case 36: res = ins_bits ? strdup(" || local()") : NULL; break;
|
||||
case 35: res = ins_bits ? rz_str_dup(" || far()") : NULL; break;
|
||||
case 36: res = ins_bits ? rz_str_dup(" || local()") : NULL; break;
|
||||
case 37: res = get_opers(ins_bits); break;
|
||||
case 38:
|
||||
res = ins_bits ? "lo" : "hi";
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
break;
|
||||
case 39: res = get_cmp_op(ins_bits); break;
|
||||
case 40:
|
||||
case 48:
|
||||
sprintf(buff_aux, "#0x%x", (ins_bits << (32 - ins_token_len) >> (32 - ins_token_len)));
|
||||
res = strdup(buff_aux);
|
||||
res = rz_str_dup(buff_aux);
|
||||
break;
|
||||
case 70:
|
||||
case 72:
|
||||
|
|
@ -594,7 +594,7 @@ static char *get_token_decoded(st32 hash_code, char *ins_token, ut32 ins_token_l
|
|||
} else {
|
||||
sprintf(buff_aux, "-#0x%lx", (long unsigned int)ins_bits);
|
||||
}
|
||||
res = strdup(buff_aux);
|
||||
res = rz_str_dup(buff_aux);
|
||||
if (!reg_arg || *reg_arg != 'm') {
|
||||
break;
|
||||
}
|
||||
|
|
@ -621,10 +621,10 @@ static char *get_token_decoded(st32 hash_code, char *ins_token, ut32 ins_token_l
|
|||
ins_bits = ins_bits << (32 - ins_token_len) >> (32 - ins_token_len);
|
||||
}
|
||||
if (reg_arg && *reg_arg == 'i') {
|
||||
res = strdup("");
|
||||
res = rz_str_dup("");
|
||||
} else {
|
||||
sprintf(buff_aux, "#0x%06lx", (long unsigned int)ins_bits);
|
||||
res = strdup(buff_aux);
|
||||
res = rz_str_dup(buff_aux);
|
||||
}
|
||||
break;
|
||||
case 42:
|
||||
|
|
@ -724,7 +724,7 @@ static char *get_token_decoded(st32 hash_code, char *ins_token, ut32 ins_token_l
|
|||
} else {
|
||||
res = "<W !flags>";
|
||||
}
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
break;
|
||||
case 53:
|
||||
case 54:
|
||||
|
|
@ -784,7 +784,7 @@ static char *get_token_decoded(st32 hash_code, char *ins_token, ut32 ins_token_l
|
|||
res = "<$/#>";
|
||||
}
|
||||
}
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
break;
|
||||
case 2:
|
||||
if (!ins_bits) {
|
||||
|
|
@ -801,7 +801,7 @@ static char *get_token_decoded(st32 hash_code, char *ins_token, ut32 ins_token_l
|
|||
res = "<%>";
|
||||
}
|
||||
}
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
break;
|
||||
case 12:
|
||||
if (!ins_bits) {
|
||||
|
|
@ -820,7 +820,7 @@ static char *get_token_decoded(st32 hash_code, char *ins_token, ut32 ins_token_l
|
|||
res = "</>";
|
||||
}
|
||||
}
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
break;
|
||||
case 29:
|
||||
if (!ins_bits) {
|
||||
|
|
@ -837,10 +837,10 @@ static char *get_token_decoded(st32 hash_code, char *ins_token, ut32 ins_token_l
|
|||
res = "<saturate>";
|
||||
}
|
||||
}
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
break;
|
||||
case 16:
|
||||
res = (ins_bits != 0) ? strdup("t3 = ") : NULL;
|
||||
res = (ins_bits != 0) ? rz_str_dup("t3 = ") : NULL;
|
||||
break;
|
||||
case 17:
|
||||
if (!ins_bits) {
|
||||
|
|
@ -857,7 +857,7 @@ static char *get_token_decoded(st32 hash_code, char *ins_token, ut32 ins_token_l
|
|||
res = "<4>";
|
||||
}
|
||||
}
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
break;
|
||||
case 78:
|
||||
if (!rz_str_ncasecmp(ins_token, "q_SAT", 5)) {
|
||||
|
|
@ -875,7 +875,7 @@ static char *get_token_decoded(st32 hash_code, char *ins_token, ut32 ins_token_l
|
|||
if (C55PLUS_DEBUG) {
|
||||
printf("OP(78): TOKEN=%s\n", res);
|
||||
}
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ char *get_tc2_tc1(ut32 ins_bits) {
|
|||
}
|
||||
res = "tc2";
|
||||
}
|
||||
return strdup(res);
|
||||
return rz_str_dup(res);
|
||||
}
|
||||
|
||||
char *get_trans_reg(ut32 ins_bits) {
|
||||
|
|
@ -52,7 +52,7 @@ char *get_trans_reg(ut32 ins_bits) {
|
|||
default:
|
||||
fprintf(stderr, "Invalid transaction instruction 0x%x\n", ins_bits);
|
||||
}
|
||||
return res ? strdup(res) : NULL;
|
||||
return rz_str_dup(res);
|
||||
}
|
||||
|
||||
char *get_AR_regs_class1(ut32 ins_bits) {
|
||||
|
|
@ -260,7 +260,7 @@ char *get_reg_pair(ut32 idx) {
|
|||
}
|
||||
|
||||
if (res != NULL) {
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
@ -325,7 +325,7 @@ char *get_reg_name_3(ut32 idx) {
|
|||
}
|
||||
|
||||
if (res != NULL) {
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
@ -380,7 +380,7 @@ char *get_reg_name_2(ut32 idx) {
|
|||
}
|
||||
|
||||
if (res != NULL) {
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
@ -635,7 +635,7 @@ char *get_reg_name_1(ut32 idx) {
|
|||
}
|
||||
|
||||
if (res != NULL) {
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
@ -850,7 +850,7 @@ char *get_status_regs_and_bits(char *reg_arg, int reg_bit) {
|
|||
}
|
||||
|
||||
if (res != NULL) {
|
||||
res = strdup(res);
|
||||
res = rz_str_dup(res);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
@ -945,71 +945,71 @@ char *get_reg_name_4(ut32 idx) {
|
|||
res = "ac7.l";
|
||||
break;
|
||||
}
|
||||
return res ? strdup(res) : NULL;
|
||||
return rz_str_dup(res);
|
||||
}
|
||||
|
||||
char *get_opers(ut8 oper_byte) {
|
||||
switch (oper_byte) {
|
||||
case 0xE0u:
|
||||
return strdup("overflow(ac0)");
|
||||
return rz_str_dup("overflow(ac0)");
|
||||
case 0xE1u:
|
||||
return strdup("overflow(ac1)");
|
||||
return rz_str_dup("overflow(ac1)");
|
||||
case 0xE2u:
|
||||
return strdup("overflow(ac2)");
|
||||
return rz_str_dup("overflow(ac2)");
|
||||
case 0xE3u:
|
||||
return strdup("overflow(ac3)");
|
||||
return rz_str_dup("overflow(ac3)");
|
||||
case 0xE4u:
|
||||
return strdup("tc1");
|
||||
return rz_str_dup("tc1");
|
||||
case 0xE5u:
|
||||
return strdup("tc2");
|
||||
return rz_str_dup("tc2");
|
||||
case 0xE6u:
|
||||
return strdup("carry");
|
||||
return rz_str_dup("carry");
|
||||
case 0xE7u:
|
||||
return strdup("overflow(govf)");
|
||||
return rz_str_dup("overflow(govf)");
|
||||
case 0xE8u:
|
||||
return strdup("tc1 & tc2");
|
||||
return rz_str_dup("tc1 & tc2");
|
||||
case 0xE9u:
|
||||
return strdup("tc1 & !tc2");
|
||||
return rz_str_dup("tc1 & !tc2");
|
||||
case 0xEAu:
|
||||
return strdup("!tc1 & tc2");
|
||||
return rz_str_dup("!tc1 & tc2");
|
||||
case 0xEBu:
|
||||
return strdup("!tc1 & !tc2");
|
||||
return rz_str_dup("!tc1 & !tc2");
|
||||
case 0xECu:
|
||||
return strdup("word_mode");
|
||||
return rz_str_dup("word_mode");
|
||||
case 0xEDu:
|
||||
return strdup("byte_mode");
|
||||
return rz_str_dup("byte_mode");
|
||||
case 0xF0u:
|
||||
return strdup("!overflow(ac0)");
|
||||
return rz_str_dup("!overflow(ac0)");
|
||||
case 0xF1u:
|
||||
return strdup("!overflow(ac1)");
|
||||
return rz_str_dup("!overflow(ac1)");
|
||||
case 0xF2u:
|
||||
return strdup("!overflow(ac2)");
|
||||
return rz_str_dup("!overflow(ac2)");
|
||||
case 0xF3u:
|
||||
return strdup("!overflow(ac3)");
|
||||
return rz_str_dup("!overflow(ac3)");
|
||||
case 0xF4u:
|
||||
return strdup("!tc1");
|
||||
return rz_str_dup("!tc1");
|
||||
case 0xF5u:
|
||||
return strdup("!tc2");
|
||||
return rz_str_dup("!tc2");
|
||||
case 0xF6u:
|
||||
return strdup("!carry");
|
||||
return rz_str_dup("!carry");
|
||||
case 0xF7u:
|
||||
return strdup("!overflow(govf)");
|
||||
return rz_str_dup("!overflow(govf)");
|
||||
case 0xF8u:
|
||||
return strdup("tc1 | tc2");
|
||||
return rz_str_dup("tc1 | tc2");
|
||||
case 0xF9u:
|
||||
return strdup("tc1 | !tc2");
|
||||
return rz_str_dup("tc1 | !tc2");
|
||||
case 0xFAu:
|
||||
return strdup("!tc1 | tc2");
|
||||
return rz_str_dup("!tc1 | tc2");
|
||||
case 0xFBu:
|
||||
return strdup("!tc1 | !tc2");
|
||||
return rz_str_dup("!tc1 | !tc2");
|
||||
case 0xFCu:
|
||||
return strdup("tc1 ^ tc2");
|
||||
return rz_str_dup("tc1 ^ tc2");
|
||||
case 0xFDu:
|
||||
return strdup("tc1 ^ !tc2");
|
||||
return rz_str_dup("tc1 ^ !tc2");
|
||||
case 0xFEu:
|
||||
return strdup("!tc1 ^ tc2");
|
||||
return rz_str_dup("!tc1 ^ tc2");
|
||||
case 0xFFu:
|
||||
return strdup("!tc1 ^ !tc2");
|
||||
return rz_str_dup("!tc1 ^ !tc2");
|
||||
default: {
|
||||
ut8 oper_type = oper_byte >> 5;
|
||||
if (oper_type != 6) {
|
||||
|
|
@ -1057,7 +1057,7 @@ char *get_cmp_op(ut32 idx) {
|
|||
case 2: res = "<"; break;
|
||||
case 3: res = ">="; break;
|
||||
}
|
||||
return res ? strdup(res) : NULL;
|
||||
return rz_str_dup(res);
|
||||
}
|
||||
|
||||
char *get_sim_reg(char *reg_arg, ut32 ins_bits) {
|
||||
|
|
@ -1069,10 +1069,10 @@ char *get_sim_reg(char *reg_arg, ut32 ins_bits) {
|
|||
case 0:
|
||||
if (reg_arg && strchr(reg_arg, 'w')) {
|
||||
if (code == 62) {
|
||||
return strdup("sim0");
|
||||
return rz_str_dup("sim0");
|
||||
}
|
||||
if (code == 63) {
|
||||
return strdup("sim0");
|
||||
return rz_str_dup("sim0");
|
||||
}
|
||||
}
|
||||
aux = get_reg_name_1(ins_bits >> 2);
|
||||
|
|
@ -1088,7 +1088,7 @@ char *get_sim_reg(char *reg_arg, ut32 ins_bits) {
|
|||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
res = strdup("<reserved>");
|
||||
res = rz_str_dup("<reserved>");
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
|
|
|
|||
|
|
@ -42,5 +42,5 @@ char *get_hex_str(ut32 hex_num) {
|
|||
aux[1] = hex_str[hex_num & 0xF];
|
||||
aux[0] = hex_str[(hex_num >> 4) & 0xF];
|
||||
|
||||
return strdup(aux);
|
||||
return rz_str_dup(aux);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#define UUTILS_H
|
||||
|
||||
#include <rz_types.h>
|
||||
#include <rz_util.h>
|
||||
#define C55PLUS_DEBUG 0
|
||||
|
||||
char *strcat_dup(char *s1, char *s2, st32 n_free);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ char *tms320_c64x_mnemonics(RzAsm *a, int id, bool json, void *c64x) {
|
|||
if (json) {
|
||||
return vname ? rz_str_newf("[\"%s\"]\n", vname) : NULL;
|
||||
}
|
||||
return vname ? strdup(vname) : NULL;
|
||||
return rz_str_dup(vname);
|
||||
}
|
||||
RzStrBuf *buf = rz_strbuf_new("");
|
||||
if (json) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#define TMS320_C64X_CAPSTONE_H
|
||||
|
||||
#include <rz_asm.h>
|
||||
#include <rz_util.h>
|
||||
#include <rz_analysis.h>
|
||||
#include <capstone/capstone.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ RZ_API bool rz_analysis_function_set_label(RzAnalysisFunction *fcn, const char *
|
|||
if (ht_sp_find(fcn->label_addrs, name, NULL)) {
|
||||
return false;
|
||||
}
|
||||
char *n = strdup(name);
|
||||
char *n = rz_str_dup(name);
|
||||
if (!ht_up_insert(fcn->labels, addr, n)) {
|
||||
free(n);
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ static bool meta_set(RzAnalysis *a, RzAnalysisMetaType type, int subtype, ut64 f
|
|||
if (is_string_with_zeroes(type, subtype)) {
|
||||
item->str = rz_str_ndup(str, item->size);
|
||||
} else {
|
||||
item->str = str ? strdup(str) : NULL;
|
||||
item->str = rz_str_dup(str);
|
||||
}
|
||||
if (str && !item->str) {
|
||||
if (!node) { // If we just created this
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ RZ_API RzAnalysisOp *rz_analysis_op_copy(RzAnalysisOp *op) {
|
|||
}
|
||||
*nop = *op;
|
||||
if (op->mnemonic) {
|
||||
nop->mnemonic = strdup(op->mnemonic);
|
||||
nop->mnemonic = rz_str_dup(op->mnemonic);
|
||||
if (!nop->mnemonic) {
|
||||
free(nop);
|
||||
return NULL;
|
||||
|
|
@ -356,13 +356,13 @@ RZ_API char *rz_analysis_op_to_string(RzAnalysis *analysis, RzAnalysisOp *op) {
|
|||
char *a0 = rz_analysis_value_to_string(op->src[0]);
|
||||
char *a1 = rz_analysis_value_to_string(op->src[1]);
|
||||
if (!r0) {
|
||||
r0 = strdup("?");
|
||||
r0 = rz_str_dup("?");
|
||||
}
|
||||
if (!a0) {
|
||||
a0 = strdup("?");
|
||||
a0 = rz_str_dup("?");
|
||||
}
|
||||
if (!a1) {
|
||||
a1 = strdup("?");
|
||||
a1 = rz_str_dup("?");
|
||||
}
|
||||
|
||||
switch (op->type) {
|
||||
|
|
@ -532,7 +532,7 @@ RZ_API char *rz_analysis_op_to_string(RzAnalysis *analysis, RzAnalysisOp *op) {
|
|||
free(r0);
|
||||
free(a0);
|
||||
free(a1);
|
||||
return strdup(ret);
|
||||
return rz_str_dup(ret);
|
||||
}
|
||||
|
||||
RZ_API const char *rz_analysis_stackop_tostring(int s) {
|
||||
|
|
@ -581,7 +581,7 @@ RZ_API RZ_NULLABLE RZ_OWN char *rz_analysis_op_describe_sp_effect(RzAnalysisOp *
|
|||
case RZ_ANALYSIS_STACK_INC:
|
||||
return rz_str_newf("%c= %" PFMT64d, op->stackptr > 0 ? '-' : '+', RZ_ABS(op->stackptr));
|
||||
case RZ_ANALYSIS_STACK_RESET:
|
||||
return strdup(":= 0");
|
||||
return rz_str_dup(":= 0");
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -658,7 +658,7 @@ RZ_API int rz_analysis_op_hint(RzAnalysisOp *op, RzAnalysisHint *hint) {
|
|||
if (hint->opcode) {
|
||||
/* XXX: this is not correct */
|
||||
free(op->mnemonic);
|
||||
op->mnemonic = strdup(hint->opcode);
|
||||
op->mnemonic = rz_str_dup(hint->opcode);
|
||||
changes++;
|
||||
}
|
||||
if (hint->esil) {
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ static char *_6502_op_mnemonic(snes_op_t *op) {
|
|||
}
|
||||
const char *end = strchr(op->name, ' ');
|
||||
if (!end) {
|
||||
return strdup(op->name);
|
||||
return rz_str_dup(op->name);
|
||||
}
|
||||
return rz_str_ndup(op->name, end - op->name);
|
||||
}
|
||||
|
|
@ -1177,7 +1177,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr N .1 .31 0\n"
|
||||
"gpr sp .8 4 0\n"
|
||||
"gpr pc .16 5 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int esil_6502_init(RzAnalysisEsil *esil) {
|
||||
|
|
|
|||
|
|
@ -1067,7 +1067,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr _sfr .32 28 0\n"
|
||||
"gpr _xdata .32 32 0\n"
|
||||
"gpr _pdata .32 36 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static ut32 map_direct_addr(RzAnalysis *analysis, ut8 addr) {
|
||||
|
|
|
|||
|
|
@ -275,7 +275,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr lr126 .32 2024 0\n"
|
||||
"gpr lr127 .32 2032 0\n"
|
||||
"gpr lr128 .32 2040 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -2106,7 +2106,7 @@ static int analysis_op(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *bu
|
|||
if (n < 1) {
|
||||
op->type = RZ_ANALYSIS_OP_TYPE_ILL;
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("invalid");
|
||||
op->mnemonic = rz_str_dup("invalid");
|
||||
}
|
||||
} else {
|
||||
#if CS_NEXT_VERSION < 6
|
||||
|
|
@ -2541,7 +2541,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"fpu q15 .128 308 0\n"
|
||||
"flg fpscr .32 324 0\n";
|
||||
}
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *analysis, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
// Store Program Memory Control and Status Register (SPMCSR)
|
||||
"gpr spmcsr .8 64 0\n";
|
||||
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *analysis, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ static int bf_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b
|
|||
op->il_op = bf_llimit(analysis, addr, op->jump);
|
||||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("while [ptr]");
|
||||
op->mnemonic = rz_str_dup("while [ptr]");
|
||||
}
|
||||
op->type = RZ_ANALYSIS_OP_TYPE_CJMP;
|
||||
op->fail = addr + 1;
|
||||
|
|
@ -199,7 +199,7 @@ static int bf_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b
|
|||
op->il_op = bf_rlimit(analysis, addr, op->jump);
|
||||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("loop");
|
||||
op->mnemonic = rz_str_dup("loop");
|
||||
}
|
||||
op->type = RZ_ANALYSIS_OP_TYPE_UJMP;
|
||||
break;
|
||||
|
|
@ -209,7 +209,7 @@ static int bf_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b
|
|||
op->il_op = bf_right_arrow();
|
||||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("inc ptr");
|
||||
op->mnemonic = rz_str_dup("inc ptr");
|
||||
}
|
||||
break;
|
||||
case '<':
|
||||
|
|
@ -218,7 +218,7 @@ static int bf_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b
|
|||
op->il_op = bf_left_arrow();
|
||||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("dec ptr");
|
||||
op->mnemonic = rz_str_dup("dec ptr");
|
||||
}
|
||||
break;
|
||||
case '+':
|
||||
|
|
@ -227,7 +227,7 @@ static int bf_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b
|
|||
op->il_op = bf_inc();
|
||||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("inc [ptr]");
|
||||
op->mnemonic = rz_str_dup("inc [ptr]");
|
||||
}
|
||||
break;
|
||||
case '-':
|
||||
|
|
@ -236,7 +236,7 @@ static int bf_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b
|
|||
op->il_op = bf_dec();
|
||||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("dec [ptr]");
|
||||
op->mnemonic = rz_str_dup("dec [ptr]");
|
||||
}
|
||||
break;
|
||||
case '.':
|
||||
|
|
@ -244,7 +244,7 @@ static int bf_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b
|
|||
op->il_op = bf_out();
|
||||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("out [ptr]");
|
||||
op->mnemonic = rz_str_dup("out [ptr]");
|
||||
}
|
||||
op->type = RZ_ANALYSIS_OP_TYPE_STORE;
|
||||
break;
|
||||
|
|
@ -253,7 +253,7 @@ static int bf_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b
|
|||
op->il_op = bf_in();
|
||||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("in [ptr]");
|
||||
op->mnemonic = rz_str_dup("in [ptr]");
|
||||
}
|
||||
op->type = RZ_ANALYSIS_OP_TYPE_LOAD;
|
||||
break;
|
||||
|
|
@ -261,7 +261,7 @@ static int bf_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b
|
|||
case 0xff:
|
||||
op->type = RZ_ANALYSIS_OP_TYPE_TRAP;
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("trap");
|
||||
op->mnemonic = rz_str_dup("trap");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
@ -270,7 +270,7 @@ static int bf_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b
|
|||
op->il_op = rz_il_op_new_nop();
|
||||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("nop");
|
||||
op->mnemonic = rz_str_dup("nop");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -278,7 +278,7 @@ static int bf_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8 *b
|
|||
}
|
||||
|
||||
static char *get_reg_profile(RzAnalysis *analysis) {
|
||||
return strdup(
|
||||
return rz_str_dup(
|
||||
"=PC pc\n"
|
||||
"=BP ptr\n"
|
||||
"=SP ptr\n"
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ static int dalvik_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut
|
|||
int sz = dalvik_opcodes[data[0]].len;
|
||||
if (!op || sz > len) {
|
||||
if (op && (mask & RZ_ANALYSIS_OP_MASK_DISASM)) {
|
||||
op->mnemonic = strdup("invalid");
|
||||
op->mnemonic = rz_str_dup("invalid");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -754,7 +754,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr ip .32 116 0\n"
|
||||
"gpr sp .32 120 0\n"
|
||||
"gpr bp .32 124 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -1194,7 +1194,7 @@ static int gb_anop(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8
|
|||
sprintf(mn, gb_op[data[0]].name, reg);
|
||||
break;
|
||||
}
|
||||
op->mnemonic = strdup(mn);
|
||||
op->mnemonic = rz_str_dup(mn);
|
||||
}
|
||||
op->addr = addr;
|
||||
op->type = RZ_ANALYSIS_OP_TYPE_UNK;
|
||||
|
|
@ -2002,7 +2002,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr mbcram .16 16 0\n"
|
||||
|
||||
"gpr ime .1 18 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int esil_gb_init(RzAnalysisEsil *esil) {
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr Z .1 .146 0\n"
|
||||
"gpr V .1 .145 0\n"
|
||||
"gpr C .1 .144 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_h8300 = {
|
||||
|
|
|
|||
|
|
@ -745,7 +745,7 @@ RZ_API char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"sys S77:76_tmp .64 220096 0\n"
|
||||
"sys S79:78 .64 220160 0\n"
|
||||
"sys S79:78_tmp .64 220224 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_hexagon = {
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr PC1 .64 34 0\n"
|
||||
"gpr PC2 .64 34 0\n"
|
||||
"gpr PC3 .64 34 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_i4004 = {
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"=A6 garbage\n"
|
||||
"gpr pc .32 0 0\n"
|
||||
"gpr garbage .32 32 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -524,7 +524,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr sp .16 48 0\n"
|
||||
"gpr a0 .16 48 0\n"
|
||||
"gpr a1 .16 48 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static bool m680x_analysis_fini(void *user) {
|
||||
|
|
|
|||
|
|
@ -774,7 +774,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr fpcr .32 176 0\n"
|
||||
"gpr fpsr .32 180 0\n"
|
||||
"gpr fpiar .32 184 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static bool m68k_fini(void *user) {
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr cr30 .32 184 0\n"
|
||||
"gpr cr31 .32 188 0\n"
|
||||
"gpr pc .32 192 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -773,7 +773,7 @@ static int analyze_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const u
|
|||
n = cs_disasm(hndl, (ut8 *)buf, len, addr, 1, &insn);
|
||||
if (n < 1 || insn->size < 1) {
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("invalid");
|
||||
op->mnemonic = rz_str_dup("invalid");
|
||||
}
|
||||
goto beach;
|
||||
}
|
||||
|
|
@ -1209,7 +1209,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr t .64 280 0\n";
|
||||
break;
|
||||
}
|
||||
return p ? strdup(p) : NULL;
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr r13 .16 26 0\n"
|
||||
"gpr r14 .16 28 0\n"
|
||||
"gpr r15 .16 30 0\n";
|
||||
return strdup(prof);
|
||||
return rz_str_dup(prof);
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_msp430 = {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ static int null_analysis(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, cons
|
|||
}
|
||||
|
||||
static char *null_get_reg_profile(RzAnalysis *analysis) {
|
||||
return strdup("");
|
||||
return rz_str_dup("");
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_null = {
|
||||
|
|
|
|||
|
|
@ -494,7 +494,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"flg ov .1 2585 0 # Overflow\n"
|
||||
"flg ca .1 2586 0 # Carry\n"
|
||||
"gpr 0 .64 2587 0 # The zero register.\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
} else {
|
||||
p =
|
||||
"=PC pc\n"
|
||||
|
|
@ -755,7 +755,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"flg ov .1 2585 0 # Overflow\n"
|
||||
"flg ca .1 2586 0 # Carry\n"
|
||||
"gpr 0 .32 2587 0 # The zero register.\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -769,7 +769,7 @@ static int analyze_op_vle(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8
|
|||
// op->id = instr->type;
|
||||
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup(instr->name);
|
||||
op->mnemonic = rz_str_dup(instr->name);
|
||||
}
|
||||
switch (op->type) {
|
||||
case RZ_ANALYSIS_OP_TYPE_ILL:
|
||||
|
|
@ -991,7 +991,7 @@ static int analyze_op(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf
|
|||
} else {
|
||||
op->il_op = rz_ppc_cs_get_il_op(ctx->handle, insn, mode);
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup(insn->mnemonic);
|
||||
op->mnemonic = rz_str_dup(insn->mnemonic);
|
||||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_OPEX) {
|
||||
opex(&op->opex, ctx->handle, insn);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ static int archinfo(RzAnalysis *analysis, RzAnalysisInfoType query) {
|
|||
}
|
||||
|
||||
static char *get_reg_profile(RzAnalysis *analysis) {
|
||||
return strdup(
|
||||
return rz_str_dup(
|
||||
"=PC pc\n"
|
||||
"=BP bp\n"
|
||||
"=SP sp\n"
|
||||
|
|
|
|||
|
|
@ -585,7 +585,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
|
||||
break;
|
||||
}
|
||||
return (p && *p) ? strdup(p) : NULL;
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"flg isp0 .1 0 0 in_service_priority_flags_bit_0\n"
|
||||
"flg cy .1 0 0 carry\n";
|
||||
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_rl78 = {
|
||||
|
|
|
|||
|
|
@ -630,7 +630,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr $vcc .128 724 0\n"
|
||||
"gpr $vce .128 740 0\n";
|
||||
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ static char *analysis_rx_reg_profile(RzAnalysis *analysis) {
|
|||
"flg fof .1 .772 0\n"
|
||||
"flg fvf .1 .773 0\n"
|
||||
"flg rmode .2 .798 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_rx = {
|
||||
|
|
|
|||
|
|
@ -1171,7 +1171,7 @@ static RZ_OWN char *sh_get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr macl .32 132 0\n"
|
||||
"gpr pr .32 136 0\n";
|
||||
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr i6 .32 136 0\n"
|
||||
"gpr fp .32 136 0\n"
|
||||
"gpr i7 .32 140 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr N .1 .31 0\n"
|
||||
"gpr sp .8 4 0\n"
|
||||
"gpr pc .16 5 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_spc700 = {
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr r13 .32 52 0\n"
|
||||
"gpr r14 .32 56 0\n"
|
||||
"gpr r15 .32 60 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -342,7 +342,7 @@ static char *get_reg_profile(RZ_BORROW RzAnalysis *a) {
|
|||
;
|
||||
}
|
||||
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_tms320 = {
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ static char *tricore_reg_profile(RzAnalysis *_) {
|
|||
"drx set_FZ .1 902 0\n"
|
||||
"drx set_FU .1 903 0\n"
|
||||
"drx set_FX .1 904 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static void tricore_opex(RzAsmTriCoreContext *ctx, RzStrBuf *sb);
|
||||
|
|
@ -275,7 +275,7 @@ tricore_op(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *data, int len,
|
|||
if (ctx->count <= 0 || !ctx->insn) {
|
||||
op->type = RZ_ANALYSIS_OP_TYPE_ILL;
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("invalid");
|
||||
op->mnemonic = rz_str_dup("invalid");
|
||||
}
|
||||
goto beach;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -559,7 +559,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"flg s .1 152.30 0\n"
|
||||
"flg z .1 152.31 0\n";
|
||||
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_v810 = {
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"flg ov .1 152.29 0\n" // overflow
|
||||
"flg s .1 152.30 0\n" // signed result
|
||||
"flg z .1 152.31 0\n"; // zero result
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
|||
}
|
||||
|
||||
static char *get_reg_profile(RzAnalysis *analysis) {
|
||||
return strdup(
|
||||
return rz_str_dup(
|
||||
"=PC pc\n"
|
||||
"=BP bp\n"
|
||||
"=SP sp\n"
|
||||
|
|
|
|||
|
|
@ -3156,7 +3156,7 @@ static int analyze_op(RzAnalysis *a, RzAnalysisOp *op, ut64 addr, const ut8 *buf
|
|||
if (n < 1) {
|
||||
op->type = RZ_ANALYSIS_OP_TYPE_ILL;
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup("invalid");
|
||||
op->mnemonic = rz_str_dup("invalid");
|
||||
}
|
||||
} else {
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
|
|
@ -3706,7 +3706,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
break;
|
||||
#endif
|
||||
}
|
||||
return (p && *p) ? strdup(p) : NULL;
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ static char *mnemonics(RzAsm *a, int id, bool json) {
|
|||
if (json) {
|
||||
return name ? rz_str_newf("[\"%s\"]\n", name) : NULL;
|
||||
}
|
||||
return name ? strdup(name) : NULL;
|
||||
return rz_str_dup(name);
|
||||
}
|
||||
RzStrBuf *buf = rz_strbuf_new("");
|
||||
if (json) {
|
||||
|
|
|
|||
|
|
@ -22,21 +22,21 @@ static RZ_OWN RzPVector /*<RzAsmTokenPattern *>*/ *get_token_patterns(RzAsm *a)
|
|||
// Mnemonic pattern
|
||||
RzAsmTokenPattern *pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_MNEMONIC;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"^(while|inc|dec|out|in|trap|nop|invalid|loop)");
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
||||
// ptr pattern
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_REGISTER;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"ptr");
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
||||
// reference pattern
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_OPERATOR;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"\\[|\\]" // Matches a single bracket
|
||||
);
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
|
@ -44,7 +44,7 @@ static RZ_OWN RzPVector /*<RzAsmTokenPattern *>*/ *get_token_patterns(RzAsm *a)
|
|||
// Separator pattern
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_SEPARATOR;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"\\s+");
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ static int dalvik_disassemble(RzAsm *a, RzAsmOp *op, const ut8 *buf, int len) {
|
|||
|
||||
strasm = NULL;
|
||||
if (size <= len) {
|
||||
strasm = strdup(dalvik_opcodes[i].name);
|
||||
strasm = rz_str_dup(dalvik_opcodes[i].name);
|
||||
size = dalvik_opcodes[i].len;
|
||||
switch (dalvik_opcodes[i].fmt) {
|
||||
case fmtop: break;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ static RZ_OWN RzPVector /*<RzAsmTokenPattern *>*/ *get_token_patterns() {
|
|||
|
||||
RzAsmTokenPattern *pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_META;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"^[\\[\\?\\/\\|\\\\\\{┌│└]|" // Packet prefix
|
||||
"(∎|[<\\}])[\\s:]endloop[01]{1,2}" // Endloop markers
|
||||
);
|
||||
|
|
@ -32,7 +32,7 @@ static RZ_OWN RzPVector /*<RzAsmTokenPattern *>*/ *get_token_patterns() {
|
|||
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_META;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"\\#{1,2}|\\}$|" // Immediate prefix, Closing packet bracket
|
||||
"\\.new|:n?t|:raw|<err>" // .new and jump hints
|
||||
);
|
||||
|
|
@ -40,42 +40,42 @@ static RZ_OWN RzPVector /*<RzAsmTokenPattern *>*/ *get_token_patterns() {
|
|||
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_REGISTER;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"[CNPRMQVO]\\d{1,2}(:\\d{1,2})?(in)?" // Registers and double registers
|
||||
);
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_REGISTER;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"GP|HTID|UGP|LR|FP|SP" // Other regs
|
||||
);
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_NUMBER;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"0x(\\d|[abcdef])+" // Hexadecimal numbers
|
||||
);
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_MNEMONIC;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"\\w+_\\w+|[a-zA-Z]+\\d+[a-zA-Z]*" // Mnemonics with a decimal number in the name.
|
||||
);
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_NUMBER;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"\\d+" // Decimal numbers
|
||||
);
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_SEPARATOR;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"\\s+|" // Spaces and tabs
|
||||
"[,;\\.\\(\\)\\{\\}:]" // Brackets and others
|
||||
);
|
||||
|
|
@ -83,21 +83,21 @@ static RZ_OWN RzPVector /*<RzAsmTokenPattern *>*/ *get_token_patterns() {
|
|||
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_OPERATOR;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"[+*&+?=!^\\/|-]{1,2}" // +,-,=,],[, ! (not the packet prefix)
|
||||
);
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_OPERATOR;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"\\]|\\[|<{1,2}|>{1,2}" // +,-,=,],[, ! (not the packet prefix)
|
||||
);
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
||||
pat = RZ_NEW0(RzAsmTokenPattern);
|
||||
pat->type = RZ_ASM_TOKEN_MNEMONIC;
|
||||
pat->pattern = strdup(
|
||||
pat->pattern = rz_str_dup(
|
||||
"\\w+" // Alphanumeric mnemonics
|
||||
);
|
||||
rz_pvector_push(pvec, pat);
|
||||
|
|
@ -129,7 +129,7 @@ static bool hex_cfg_set(void *user, void *data) {
|
|||
}
|
||||
if (cnode) {
|
||||
pnode->i_value = cnode->i_value;
|
||||
pnode->value = strdup(cnode->value);
|
||||
pnode->value = rz_str_dup(cnode->value);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ beach:
|
|||
do { \
|
||||
RzAsmTokenPattern *pat = RZ_NEW0(RzAsmTokenPattern); \
|
||||
pat->type = RZ_ASM_TOKEN_##_type; \
|
||||
pat->pattern = strdup(_pat); \
|
||||
pat->pattern = rz_str_dup(_pat); \
|
||||
rz_pvector_push(pvec, pat); \
|
||||
} while (0)
|
||||
|
||||
|
|
|
|||
|
|
@ -5120,7 +5120,7 @@ static int parseOpcode(RzAsm *a, const char *op, Opcode *out) {
|
|||
op += 4;
|
||||
}
|
||||
char *args = strchr(op, ' ');
|
||||
out->mnemonic = args ? rz_str_ndup(op, args - op) : strdup(op);
|
||||
out->mnemonic = args ? rz_str_ndup(op, args - op) : rz_str_dup(op);
|
||||
out->operands[0].type = out->operands[1].type = 0;
|
||||
out->operands[0].extended = out->operands[1].extended = false;
|
||||
out->operands[0].reg = out->operands[0].regs[0] = out->operands[0].regs[1] = X86R_UNDEFINED;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ typedef struct {
|
|||
if (json) { \
|
||||
return vname ? rz_str_newf("[\"%s\"]\n", vname) : NULL; \
|
||||
} \
|
||||
return vname ? strdup(vname) : NULL; \
|
||||
return rz_str_dup(vname); \
|
||||
} \
|
||||
RzStrBuf *buf = rz_strbuf_new(""); \
|
||||
if (json) { \
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ RzList /*<char *>*/ *_6502_tokenize(const char *assembly, size_t length) {
|
|||
}
|
||||
|
||||
if (insert_zero) {
|
||||
rz_list_insert(tokens, rz_list_length(tokens) - 1, strdup("0"));
|
||||
rz_list_insert(tokens, rz_list_length(tokens) - 1, rz_str_dup("0"));
|
||||
}
|
||||
|
||||
return tokens;
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ static char *subvar_stack(RzParse *p, RzAnalysisOp *op, RZ_NULLABLE RzAnalysisFu
|
|||
static bool subvar(RzParse *p, RzAnalysisFunction *f, RzAnalysisOp *op, char *data, char *str, int len) {
|
||||
const ut64 addr = op->addr;
|
||||
const int oplen = op->size;
|
||||
char *tstr = strdup(data);
|
||||
char *tstr = rz_str_dup(data);
|
||||
if (!tstr) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ RzList /*<char *>*/ *avr_tokenize(const char *assembly, size_t length) {
|
|||
}
|
||||
|
||||
if (insert_zero) {
|
||||
rz_list_insert(tokens, rz_list_length(tokens) - 1, strdup("0"));
|
||||
rz_list_insert(tokens, rz_list_length(tokens) - 1, rz_str_dup("0"));
|
||||
}
|
||||
|
||||
return tokens;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ RzList /*<char *>*/ *m68k_tokenize(const char *assembly, size_t length) {
|
|||
}
|
||||
|
||||
static bool parse(RzParse *parse, const char *assembly, RzStrBuf *sb) {
|
||||
char *copy = strdup(assembly);
|
||||
char *copy = rz_str_dup(assembly);
|
||||
if (!copy) {
|
||||
rz_strbuf_setf(sb, "asm(\"%s\")", assembly);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ RzList /*<char *>*/ *mips_tokenize(const char *assembly, size_t length) {
|
|||
}
|
||||
|
||||
if (insert_zero) {
|
||||
rz_list_insert(tokens, rz_list_length(tokens) - 1, strdup("0"));
|
||||
rz_list_insert(tokens, rz_list_length(tokens) - 1, rz_str_dup("0"));
|
||||
}
|
||||
|
||||
return tokens;
|
||||
|
|
@ -240,7 +240,7 @@ static char *subvar_stack(RzParse *p, RzAnalysisOp *op, RZ_NULLABLE RzAnalysisFu
|
|||
}
|
||||
|
||||
static bool subvar(RzParse *p, RzAnalysisFunction *f, RzAnalysisOp *op, char *data, char *str, int len) {
|
||||
char *tstr = strdup(data);
|
||||
char *tstr = rz_str_dup(data);
|
||||
tstr = subvar_stack(p, op, f, tstr);
|
||||
bool ret = true;
|
||||
if (len > strlen(tstr)) {
|
||||
|
|
|
|||
|
|
@ -1704,7 +1704,7 @@ static bool parse(RzParse *p, const char *data, RzStrBuf *sb) {
|
|||
}
|
||||
replace(nw, wa, str);
|
||||
{
|
||||
char *p = strdup(str);
|
||||
char *p = rz_str_dup(str);
|
||||
p = rz_str_replace(p, "+ -", "- ", 0);
|
||||
p = rz_str_replace(p, " + ]", "] ", 0);
|
||||
// p = rz_str_replace (p, "if (r0 == r0) trap", "trap ", 0);
|
||||
|
|
|
|||
|
|
@ -120,13 +120,13 @@ RzList /*<char *>*/ *v850_tokenize(const char *assembly, size_t length) {
|
|||
buf = rz_list_first(tokens);
|
||||
for (i = 0; i < RZ_ARRAY_SIZE(v850_short_op); ++i) {
|
||||
if (!strcmp(buf, v850_short_op[i])) {
|
||||
rz_list_insert(tokens, 1, strdup("0"));
|
||||
rz_list_insert(tokens, 1, rz_str_dup("0"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (insert_zero) {
|
||||
rz_list_insert(tokens, rz_list_length(tokens) - 1, strdup("0"));
|
||||
rz_list_insert(tokens, rz_list_length(tokens) - 1, rz_str_dup("0"));
|
||||
}
|
||||
|
||||
return tokens;
|
||||
|
|
|
|||
|
|
@ -176,8 +176,8 @@ static bool parse(RzParse *p, const char *data, RzStrBuf *sb) {
|
|||
if (len >= sizeof(w0) || sz >= sizeof(w0)) {
|
||||
return false;
|
||||
}
|
||||
// strdup can be slow here :?
|
||||
if (!(buf = strdup(data))) {
|
||||
// rz_str_dup can be slow here :?
|
||||
if (!(buf = rz_str_dup(data))) {
|
||||
return false;
|
||||
}
|
||||
*w0 = *w1 = *w2 = *w3 = '\0';
|
||||
|
|
@ -391,7 +391,7 @@ static char *subvar_stack(RzParse *p, RzAnalysisOp *op, RZ_NULLABLE RzAnalysisFu
|
|||
static bool subvar(RzParse *p, RzAnalysisFunction *f, RzAnalysisOp *op, char *data, char *str, int len) {
|
||||
const ut64 addr = op->addr;
|
||||
const int oplen = op->size;
|
||||
char *tstr = strdup(data);
|
||||
char *tstr = rz_str_dup(data);
|
||||
if (!tstr) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1127,7 +1127,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
/* TODO: */
|
||||
/* Should I add the Auxiliary Register Set? */
|
||||
/* it contains the flag bits, amongst other things */
|
||||
return strdup(p16);
|
||||
return rz_str_dup(p16);
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_arc_gnu = {
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr r15 .32 60 0\n"
|
||||
// ADD P REGISTERS
|
||||
;
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
RzAnalysisPlugin rz_analysis_plugin_cris_gnu = {
|
||||
|
|
|
|||
|
|
@ -1767,7 +1767,7 @@ static char *mips_get_reg_profile(RzAnalysis *analysis) {
|
|||
/* extra */
|
||||
"gpr pc .64 272 0\n";
|
||||
#endif
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -328,7 +328,7 @@ static int riscv_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8
|
|||
}
|
||||
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_DISASM) {
|
||||
op->mnemonic = strdup(o->name);
|
||||
op->mnemonic = rz_str_dup(o->name);
|
||||
}
|
||||
|
||||
if (o->args) {
|
||||
|
|
@ -655,7 +655,7 @@ static int riscv_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut8
|
|||
}
|
||||
if (mask & RZ_ANALYSIS_OP_MASK_VAL && args.num) {
|
||||
op->dst = RZ_NEW0(RzAnalysisValue);
|
||||
char *argf = strdup(o->args);
|
||||
char *argf = rz_str_dup(o->args);
|
||||
const char *comma = NULL;
|
||||
int dst_idx = 0, src_idx;
|
||||
if (op->type == RZ_ANALYSIS_OP_TYPE_STORE) {
|
||||
|
|
@ -905,7 +905,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
|
||||
break;
|
||||
}
|
||||
return (p && *p) ? strdup(p) : NULL;
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -594,7 +594,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"fpu qf60 .128 544 0\n" /* df60 df62 */
|
||||
"gpr fsr .64 560 0\n"; /* note that
|
||||
we've left out the filler */
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -2017,7 +2017,7 @@ static int xtensa_op(RzAnalysis *analysis, RzAnalysisOp *op, ut64 addr, const ut
|
|||
}
|
||||
|
||||
static char *get_reg_profile(RzAnalysis *analysis) {
|
||||
return strdup(
|
||||
return rz_str_dup(
|
||||
// Assuming call0 ABI
|
||||
"# a0 return address\n"
|
||||
"# a1 stack pointer\n"
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ static char *get_reg_profile(RzAnalysis *analysis) {
|
|||
"gpr mbcram .16 16 0\n"
|
||||
|
||||
"gpr ime .1 18 0\n";
|
||||
return strdup(p);
|
||||
return rz_str_dup(p);
|
||||
}
|
||||
|
||||
static int archinfo(RzAnalysis *a, RzAnalysisInfoType query) {
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ static bool parse(RzParse *p, const char *data, RzStrBuf *sb) {
|
|||
rz_str_cpy(num + 1, ptr);
|
||||
ptr = (char *)rz_str_lchr(buf, ']');
|
||||
if (n && ptr) {
|
||||
char *rest = strdup(ptr + 1);
|
||||
char *rest = rz_str_dup(ptr + 1);
|
||||
size_t dist = len + 1 - (ptr - buf);
|
||||
if (n > 0) {
|
||||
snprintf(ptr, dist, "+%d]%s", n, rest);
|
||||
|
|
@ -208,7 +208,7 @@ static bool parse(RzParse *p, const char *data, RzStrBuf *sb) {
|
|||
}
|
||||
}
|
||||
{
|
||||
char *s = strdup(str);
|
||||
char *s = rz_str_dup(str);
|
||||
s = rz_str_replace(s, "+ -", "- ", 1);
|
||||
s = rz_str_replace(s, "- -", "+ ", 1);
|
||||
rz_strf(str, "%s", s);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ RZ_API bool rz_parse_use(RzParse *p, const char *name) {
|
|||
// this function is a bit confussing, assembles C code into wat?, whehres theh input and wheres the output
|
||||
// and its unused. so imho it sshould be DEPRECATED this conflicts with rasm.assemble imhoh
|
||||
RZ_API bool rz_parse_assemble(RzParse *p, char *data, char *str) {
|
||||
char *in = strdup(str);
|
||||
char *in = rz_str_dup(str);
|
||||
bool ret = false;
|
||||
char *s, *o;
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ static RzType *procedure_parse(
|
|||
if (!name) {
|
||||
typ->callable->name = create_type_name_from_offset(type->index);
|
||||
} else {
|
||||
typ->callable->name = strdup(name);
|
||||
typ->callable->name = rz_str_dup(name);
|
||||
}
|
||||
|
||||
typ->callable->cc = rz_bin_pdb_calling_convention_as_string(lf_procedure->func_attr.calling_convention);
|
||||
|
|
@ -201,7 +201,7 @@ static RzType *mfunction_parse(const RzTypeDB *typedb, RzPdbTpiStream *stream, R
|
|||
}
|
||||
type->kind = RZ_TYPE_KIND_CALLABLE;
|
||||
type->callable = callable;
|
||||
type->callable->name = strdup(name);
|
||||
type->callable->name = rz_str_dup(name);
|
||||
type->callable->cc = rz_bin_pdb_calling_convention_as_string(lf_mfunction->func_attr.calling_convention);
|
||||
// parse return type
|
||||
RzPdbTpiType *ret_type = rz_bin_pdb_get_type_by_index(stream, lf_mfunction->return_type);
|
||||
|
|
@ -368,7 +368,7 @@ static RzTypeStructMember *class_member_parse(
|
|||
if (!member) {
|
||||
goto cleanup;
|
||||
}
|
||||
member->name = strdup(name);
|
||||
member->name = rz_str_dup(name);
|
||||
member->type = type;
|
||||
member->offset = offset;
|
||||
return member;
|
||||
|
|
@ -400,7 +400,7 @@ static RzType *create_rztype(RzPdbTpiType *type, RzTypeIdentifierKind kind, cons
|
|||
}
|
||||
t->kind = RZ_TYPE_KIND_IDENTIFIER;
|
||||
t->identifier.kind = kind;
|
||||
t->identifier.name = is_tpitype_unnamed(name) ? create_type_name_from_offset(type->index) : strdup(name);
|
||||
t->identifier.name = is_tpitype_unnamed(name) ? create_type_name_from_offset(type->index) : rz_str_dup(name);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
|
@ -462,7 +462,7 @@ static RzType *class_parse(const RzTypeDB *typedb, RzPdbTpiStream *stream, RzPdb
|
|||
return NULL;
|
||||
}
|
||||
base_type->type = typ;
|
||||
base_type->name = strdup(typ->identifier.name);
|
||||
base_type->name = rz_str_dup(typ->identifier.name);
|
||||
base_type->attrs = RZ_TYPE_TYPECLASS_INVALID;
|
||||
if (!rz_type_db_save_base_type(typedb, base_type)) {
|
||||
return NULL;
|
||||
|
|
@ -544,7 +544,7 @@ static RzTypeUnionMember *union_member_parse(const RzTypeDB *typedb, RzPdbTpiStr
|
|||
if (!member) {
|
||||
goto cleanup;
|
||||
}
|
||||
member->name = strdup(name);
|
||||
member->name = rz_str_dup(name);
|
||||
member->type = type;
|
||||
member->offset = offset;
|
||||
return member;
|
||||
|
|
@ -592,7 +592,7 @@ static RzType *union_parse(const RzTypeDB *typedb, RzPdbTpiStream *stream, RzPdb
|
|||
return NULL;
|
||||
}
|
||||
base_type->type = typ;
|
||||
base_type->name = strdup(typ->identifier.name);
|
||||
base_type->name = rz_str_dup(typ->identifier.name);
|
||||
base_type->attrs = RZ_TYPE_TYPECLASS_INVALID;
|
||||
if (!rz_type_db_save_base_type(typedb, base_type)) {
|
||||
return NULL;
|
||||
|
|
@ -644,7 +644,7 @@ static RzTypeEnumCase *enumerate_parse(RzPdbTpiType *type) {
|
|||
if (!cas) {
|
||||
goto cleanup;
|
||||
}
|
||||
cas->name = strdup(name);
|
||||
cas->name = rz_str_dup(name);
|
||||
cas->val = value;
|
||||
return cas;
|
||||
cleanup:
|
||||
|
|
@ -696,7 +696,7 @@ static RzType *enum_parse(const RzTypeDB *typedb, RzPdbTpiStream *stream, RzPdbT
|
|||
rz_type_base_type_free(base_type);
|
||||
return NULL;
|
||||
}
|
||||
base_type->name = is_tpitype_unnamed(name) ? create_type_name_from_offset(type->index) : strdup(name);
|
||||
base_type->name = is_tpitype_unnamed(name) ? create_type_name_from_offset(type->index) : rz_str_dup(name);
|
||||
base_type->size = rz_type_db_get_bitsize(typedb, btype);
|
||||
base_type->type = btype;
|
||||
base_type->attrs = RZ_TYPE_TYPECLASS_INVALID;
|
||||
|
|
|
|||
|
|
@ -27,12 +27,12 @@ RZ_API RZ_OWN RzPlatformProfile *rz_platform_profile_new() {
|
|||
if (!profile) {
|
||||
return NULL;
|
||||
}
|
||||
profile->registers_mmio = ht_up_new((HtUPDupValue)strdup, free);
|
||||
profile->registers_mmio = ht_up_new((HtUPDupValue)rz_str_dup, free);
|
||||
if (!profile->registers_mmio) {
|
||||
free(profile);
|
||||
return NULL;
|
||||
}
|
||||
profile->registers_extended = ht_up_new((HtUPDupValue)strdup, free);
|
||||
profile->registers_extended = ht_up_new((HtUPDupValue)rz_str_dup, free);
|
||||
if (!profile->registers_extended) {
|
||||
ht_up_free(profile->registers_mmio);
|
||||
free(profile);
|
||||
|
|
@ -235,8 +235,8 @@ RZ_API bool rz_platform_profiles_init(RzPlatformTarget *t, const char *cpu, cons
|
|||
}
|
||||
free(t->cpu);
|
||||
free(t->arch);
|
||||
t->cpu = strdup(cpu);
|
||||
t->arch = strdup(arch);
|
||||
t->cpu = rz_str_dup(cpu);
|
||||
t->arch = rz_str_dup(arch);
|
||||
rz_platform_load_profile_sdb(t, path);
|
||||
free(path);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ RZ_API RZ_OWN RzPlatformItem *rz_platform_item_new(RZ_NULLABLE const char *name)
|
|||
if (!item) {
|
||||
return NULL;
|
||||
}
|
||||
item->name = name ? strdup(name) : NULL;
|
||||
item->name = rz_str_dup(name);
|
||||
item->comment = NULL;
|
||||
return item;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ RZ_API char *rz_analysis_rtti_msvc_demangle_class_name(RVTableContext *context,
|
|||
if (ret && *ret) {
|
||||
char *n = strchr(ret, ' ');
|
||||
if (n && *(++n)) {
|
||||
char *tmp = strdup(n);
|
||||
char *tmp = rz_str_dup(n);
|
||||
free(ret);
|
||||
ret = tmp;
|
||||
} else {
|
||||
|
|
@ -792,7 +792,7 @@ RecoveryTypeDescriptor *recovery_analysis_type_descriptor(RRTTIMSVCAnalContext *
|
|||
|
||||
static char *unique_class_name(RzAnalysis *analysis, const char *original_name) {
|
||||
if (!rz_analysis_class_exists(analysis, original_name)) {
|
||||
return strdup(original_name);
|
||||
return rz_str_dup(original_name);
|
||||
}
|
||||
|
||||
char *name = NULL;
|
||||
|
|
@ -879,7 +879,7 @@ static void recovery_apply_bases(RRTTIMSVCAnalContext *context, const char *clas
|
|||
RzAnalysisBaseClass base;
|
||||
base.id = NULL;
|
||||
base.offset = (ut64)base_desc->bcd->where.mdisp;
|
||||
base.class_name = strdup(base_class_name);
|
||||
base.class_name = rz_str_dup(base_class_name);
|
||||
rz_analysis_class_base_set(context->vt_context->analysis, class_name, &base);
|
||||
rz_analysis_class_base_fini(&base);
|
||||
}
|
||||
|
|
@ -905,7 +905,7 @@ static const char *recovery_apply_complete_object_locator(RRTTIMSVCAnalContext *
|
|||
char *name = rz_analysis_rtti_msvc_demangle_class_name(context->vt_context, col->td->td.name);
|
||||
if (!name) {
|
||||
RZ_LOG_DEBUG("Failed to demangle a class name: \"%s\"\n", col->td->td.name);
|
||||
name = strdup(col->td->td.name);
|
||||
name = rz_str_dup(col->td->td.name);
|
||||
if (!name) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -942,7 +942,7 @@ static const char *recovery_apply_type_descriptor(RRTTIMSVCAnalContext *context,
|
|||
char *name = rz_analysis_rtti_msvc_demangle_class_name(context->vt_context, td->td.name);
|
||||
if (!name) {
|
||||
RZ_LOG_DEBUG("Failed to demangle a class name: \"%s\"\n", td->td.name);
|
||||
name = strdup(td->td.name);
|
||||
name = rz_str_dup(td->td.name);
|
||||
if (!name) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -710,7 +710,7 @@ RZ_API RZ_OWN RzAnalysisVar *rz_serialize_analysis_var_load(
|
|||
if (!ret) {
|
||||
goto beach;
|
||||
}
|
||||
ret->name = strdup(name);
|
||||
ret->name = rz_str_dup(name);
|
||||
ret->type = vartype;
|
||||
ret->fcn = fcn;
|
||||
rz_mem_copy(&ret->storage, sizeof(RzAnalysisVarStorage), &storage, sizeof(RzAnalysisVarStorage));
|
||||
|
|
@ -727,7 +727,7 @@ RZ_API RZ_OWN RzAnalysisVar *rz_serialize_analysis_var_load(
|
|||
ret->kind = k;
|
||||
if (comment) {
|
||||
free(ret->comment);
|
||||
ret->comment = strdup(comment);
|
||||
ret->comment = rz_str_dup(comment);
|
||||
}
|
||||
RzAnalysisVarAccess *acc;
|
||||
rz_vector_foreach (&accesses, acc) {
|
||||
|
|
@ -1209,7 +1209,7 @@ static bool function_load_cb(void *user, const SdbKv *kv) {
|
|||
if (function->name) {
|
||||
free(function->name);
|
||||
}
|
||||
function->name = strdup(child->str_value);
|
||||
function->name = rz_str_dup(child->str_value);
|
||||
break;
|
||||
case FUNCTION_FIELD_BITS:
|
||||
if (child->type != RZ_JSON_INTEGER) {
|
||||
|
|
@ -1297,7 +1297,7 @@ static bool function_load_cb(void *user, const SdbKv *kv) {
|
|||
if (baby->type != RZ_JSON_STRING) {
|
||||
continue;
|
||||
}
|
||||
char *import = strdup(baby->str_value);
|
||||
char *import = rz_str_dup(baby->str_value);
|
||||
if (!import) {
|
||||
break;
|
||||
}
|
||||
|
|
@ -1713,7 +1713,7 @@ static bool meta_load_cb(void *user, const SdbKv *kv) {
|
|||
item->type = type;
|
||||
item->subtype = subtype;
|
||||
item->space = space_name ? rz_spaces_get(&analysis->meta_spaces, space_name) : NULL;
|
||||
item->str = str ? strdup(str) : NULL;
|
||||
item->str = rz_str_dup(str);
|
||||
if (str && !item->str) {
|
||||
free(item);
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ static RZ_OWN RzType *var_type_default(RzAnalysis *analysis, int size) {
|
|||
return NULL;
|
||||
}
|
||||
type->kind = RZ_TYPE_KIND_IDENTIFIER;
|
||||
type->identifier.name = strdup(typestr);
|
||||
type->identifier.name = rz_str_dup(typestr);
|
||||
if (!type->identifier.name) {
|
||||
free(type);
|
||||
return NULL;
|
||||
|
|
@ -370,7 +370,7 @@ RZ_API RZ_BORROW RzAnalysisVar *rz_analysis_function_set_var(
|
|||
RZ_FREE(var->name);
|
||||
}
|
||||
|
||||
var->name = strdup(name);
|
||||
var->name = rz_str_dup(name);
|
||||
var->storage = *stor;
|
||||
rz_analysis_var_storage_poolify(fcn->analysis, &var->storage);
|
||||
if (type) {
|
||||
|
|
@ -744,7 +744,7 @@ RZ_API RZ_NULLABLE char *rz_analysis_function_var_expr_for_reg_access_at(RzAnaly
|
|||
if (var_offset) {
|
||||
return rz_str_newf("%s + 0x%" PFMT64x, var->name, var_offset);
|
||||
} else {
|
||||
return strdup(var->name);
|
||||
return rz_str_dup(var->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -764,7 +764,7 @@ RZ_API bool rz_analysis_var_rename(RzAnalysisVar *var, const char *new_name, boo
|
|||
}
|
||||
return false;
|
||||
}
|
||||
char *nn = strdup(new_name);
|
||||
char *nn = rz_str_dup(new_name);
|
||||
if (!nn) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1126,7 +1126,7 @@ static void extract_stack_var(RzAnalysis *analysis, RzAnalysisFunction *fcn, RzA
|
|||
if (!op_esil) {
|
||||
return;
|
||||
}
|
||||
esil_buf = strdup(op_esil);
|
||||
esil_buf = rz_str_dup(op_esil);
|
||||
if (!esil_buf) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -1235,7 +1235,7 @@ static void extract_stack_var(RzAnalysis *analysis, RzAnalysisFunction *fcn, RzA
|
|||
}
|
||||
if (sum_sz == stack_off) {
|
||||
vartype = tp;
|
||||
varname = strdup(rz_type_func_args_name(analysis->typedb, fname, i));
|
||||
varname = rz_str_dup(rz_type_func_args_name(analysis->typedb, fname, i));
|
||||
break;
|
||||
}
|
||||
ut64 bit_sz = rz_type_db_get_bitsize(analysis->typedb, tp);
|
||||
|
|
@ -1451,7 +1451,7 @@ RZ_API void rz_analysis_extract_rarg(RzAnalysis *analysis, RzAnalysisOp *op, RzA
|
|||
}
|
||||
if (found_arg) {
|
||||
type = found_arg->type;
|
||||
vname = name = strdup(found_arg->name);
|
||||
vname = name = rz_str_dup(found_arg->name);
|
||||
}
|
||||
}
|
||||
if (!vname) {
|
||||
|
|
@ -1515,7 +1515,7 @@ RZ_API void rz_analysis_extract_rarg(RzAnalysis *analysis, RzAnalysisOp *op, RzA
|
|||
if (selfreg) {
|
||||
bool is_used_like_an_arg = is_used_like_arg(selfreg, opsreg, opdreg, op, analysis);
|
||||
if (reg_set[i] != 2 && is_used_like_an_arg) {
|
||||
char *vname = strdup("self");
|
||||
char *vname = rz_str_dup("self");
|
||||
RzAnalysisVarStorage stor;
|
||||
rz_analysis_var_storage_init_reg(&stor, selfreg);
|
||||
RzAnalysisVar *newvar = rz_analysis_function_set_var(fcn, &stor, NULL, size, vname);
|
||||
|
|
@ -1536,7 +1536,7 @@ RZ_API void rz_analysis_extract_rarg(RzAnalysis *analysis, RzAnalysisOp *op, RzA
|
|||
const char *errorreg = rz_analysis_cc_error(analysis, fcn->cc);
|
||||
if (errorreg) {
|
||||
if (reg_set[i] == 0 && STR_EQUAL(opdreg, errorreg)) {
|
||||
char *vname = strdup("error");
|
||||
char *vname = rz_str_dup("error");
|
||||
RzAnalysisVarStorage stor;
|
||||
rz_analysis_var_storage_init_reg(&stor, errorreg);
|
||||
RzAnalysisVar *newvar = rz_analysis_function_set_var(fcn, &stor, NULL, size, vname);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ RZ_API RZ_OWN RzAnalysisVarGlobal *rz_analysis_var_global_new(RZ_NONNULL const c
|
|||
if (!glob) {
|
||||
return NULL;
|
||||
}
|
||||
glob->name = strdup(name);
|
||||
glob->name = rz_str_dup(name);
|
||||
glob->addr = addr;
|
||||
glob->analysis = NULL;
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ RZ_API bool rz_analysis_var_global_rename(RzAnalysis *analysis, RZ_NONNULL const
|
|||
}
|
||||
|
||||
RZ_FREE(glob->name);
|
||||
glob->name = strdup(newname);
|
||||
glob->name = rz_str_dup(newname);
|
||||
return ht_sp_update_key(analysis->ht_global_var, old_name, newname);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -106,10 +106,10 @@ RZ_API bool rz_bin_file_object_new_from_xtr_data(RzBin *bin, RzBinFile *bf, RzBi
|
|||
free(o->info->arch);
|
||||
free(o->info->machine);
|
||||
free(o->info->type);
|
||||
o->info->file = strdup(bf->file);
|
||||
o->info->arch = strdup(data->metadata->arch);
|
||||
o->info->machine = strdup(data->metadata->machine);
|
||||
o->info->type = strdup(data->metadata->type);
|
||||
o->info->file = rz_str_dup(bf->file);
|
||||
o->info->arch = rz_str_dup(data->metadata->arch);
|
||||
o->info->machine = rz_str_dup(data->metadata->machine);
|
||||
o->info->type = rz_str_dup(data->metadata->type);
|
||||
o->info->bits = data->metadata->bits;
|
||||
o->info->has_crypto = bf->o->info->has_crypto;
|
||||
data->loaded = true;
|
||||
|
|
@ -378,8 +378,8 @@ static inline bool add_file_hash(RzHashCfg *md, const char *name, RzPVector /*<R
|
|||
return false;
|
||||
}
|
||||
|
||||
fh->type = strdup(name);
|
||||
fh->hex = strdup(hash);
|
||||
fh->type = rz_str_dup(name);
|
||||
fh->hex = rz_str_dup(hash);
|
||||
rz_pvector_push(vec, fh);
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,13 +173,13 @@ RZ_API RZ_OWN char *rz_bin_symbol_name(RZ_NONNULL RzBinSymbol *s) {
|
|||
if (s->dup_count) {
|
||||
return rz_str_newf("%s_%d", s->name, s->dup_count);
|
||||
}
|
||||
return strdup(s->name);
|
||||
return rz_str_dup(s->name);
|
||||
}
|
||||
|
||||
RZ_API RzBinSymbol *rz_bin_symbol_new(const char *name, ut64 paddr, ut64 vaddr) {
|
||||
RzBinSymbol *sym = RZ_NEW0(RzBinSymbol);
|
||||
if (sym) {
|
||||
sym->name = name ? strdup(name) : NULL;
|
||||
sym->name = rz_str_dup(name);
|
||||
sym->paddr = paddr;
|
||||
sym->vaddr = vaddr;
|
||||
}
|
||||
|
|
@ -896,7 +896,7 @@ RZ_API RzBinObject *rz_bin_cur_object(RzBin *bin) {
|
|||
RZ_API void rz_bin_force_plugin(RzBin *bin, const char *name) {
|
||||
rz_return_if_fail(bin);
|
||||
free(bin->force);
|
||||
bin->force = (name && *name) ? strdup(name) : NULL;
|
||||
bin->force = RZ_STR_ISNOTEMPTY(name) ? rz_str_dup(name) : NULL;
|
||||
}
|
||||
|
||||
RZ_API const char *rz_bin_entry_type_string(int etype) {
|
||||
|
|
@ -1077,7 +1077,7 @@ RZ_API RZ_OWN RzPVector /*<RzBinMap *>*/ *rz_bin_maps_of_file_sections(RZ_NONNUL
|
|||
if (!map) {
|
||||
goto hcf;
|
||||
}
|
||||
map->name = sec->name ? strdup(sec->name) : NULL;
|
||||
map->name = rz_str_dup(sec->name);
|
||||
map->paddr = sec->paddr;
|
||||
map->psize = sec->size;
|
||||
map->vaddr = sec->vaddr;
|
||||
|
|
@ -1115,7 +1115,7 @@ RZ_API RzPVector /*<RzBinSection *>*/ *rz_bin_sections_of_maps(RzPVector /*<RzBi
|
|||
if (!sec) {
|
||||
break;
|
||||
}
|
||||
sec->name = map->name ? strdup(map->name) : NULL;
|
||||
sec->name = rz_str_dup(map->name);
|
||||
sec->paddr = map->paddr;
|
||||
sec->size = map->psize;
|
||||
sec->vaddr = map->vaddr;
|
||||
|
|
@ -1129,7 +1129,7 @@ RZ_API RzPVector /*<RzBinSection *>*/ *rz_bin_sections_of_maps(RzPVector /*<RzBi
|
|||
RZ_API RzBinSection *rz_bin_section_new(const char *name) {
|
||||
RzBinSection *s = RZ_NEW0(RzBinSection);
|
||||
if (s) {
|
||||
s->name = name ? strdup(name) : NULL;
|
||||
s->name = rz_str_dup(name);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ static RzBinClass *bin_class_new(RzBinObject *o, const char *name, const char *s
|
|||
return NULL;
|
||||
}
|
||||
|
||||
c->name = strdup(name);
|
||||
c->name = rz_str_dup(name);
|
||||
c->super = rz_str_dup(super);
|
||||
c->methods = rz_list_newf((RzListFree)rz_bin_symbol_free);
|
||||
c->fields = rz_list_newf((RzListFree)rz_bin_class_field_free);
|
||||
|
|
@ -304,7 +304,7 @@ RZ_API RZ_BORROW RzBinClass *rz_bin_object_add_class(RZ_NONNULL RzBinObject *o,
|
|||
RzBinClass *oclass = ht_sp_find(o->name_to_class_object, name, NULL);
|
||||
if (oclass) {
|
||||
if (super && !oclass->super) {
|
||||
oclass->super = strdup(super);
|
||||
oclass->super = rz_str_dup(super);
|
||||
}
|
||||
if (oclass->addr == UT64_MAX) {
|
||||
oclass->addr = vaddr;
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ static char *get_swift_field(const char *demangled, const char *classname) {
|
|||
if (p) {
|
||||
char *q = strstr(demangled, classname);
|
||||
if (q && q[strlen(classname)] == '.') {
|
||||
q = strdup(q + strlen(classname) + 1);
|
||||
q = rz_str_dup(q + strlen(classname) + 1);
|
||||
char *r = strchr(q, '.');
|
||||
if (r) {
|
||||
*r = 0;
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue