Fix dead increments in places

This commit is contained in:
Alexis Ehret 2021-01-12 23:31:44 +01:00 committed by pancake
parent 8ad2d817c2
commit a3f05a9b1a
11 changed files with 3 additions and 19 deletions

View File

@ -454,7 +454,6 @@ static bool fcn_takeover_block_recursive_followthrough_cb(RAnalBlock *block, voi
block->parent_stackptr -= ctx->stack_diff; block->parent_stackptr -= ctx->stack_diff;
r_anal_function_add_block (our_fcn, block); r_anal_function_add_block (our_fcn, block);
// TODO: add block->ninstr from our_fcn considering delay slots // TODO: add block->ninstr from our_fcn considering delay slots
our_fcn += block->ninstr;
r_anal_block_unref (block); r_anal_block_unref (block);
return true; return true;
} }

View File

@ -116,8 +116,6 @@ static RList *classes_from_symbols(RBinFile *bf) {
if (!mn) { if (!mn) {
mn = strstr (dn, cn); mn = strstr (dn, cn);
if (mn && mn[strlen (cn)] == '.') { if (mn && mn[strlen (cn)] == '.') {
mn += strlen (cn) + 1;
// eprintf ("METHOD %s %s\n", sym->classname, mn);
r_list_append (c->methods, sym); r_list_append (c->methods, sym);
} }
} }

View File

@ -398,7 +398,6 @@ static size_t get_operator_code(const char *buf, RList *names_l, bool memorize)
return 0; return 0;
} }
r_list_append (names_l, str_info); r_list_append (names_l, str_info);
buf += i;
read_len += i; read_len += i;
break; break;
} }

View File

@ -88,9 +88,7 @@ static int parse_dbi_ex_header(char *data, int max_len, SDBIExHeader *dbi_ex_hea
parse_sctring(&dbi_ex_header->modName, (unsigned char *)data, &read_bytes, max_len); parse_sctring(&dbi_ex_header->modName, (unsigned char *)data, &read_bytes, max_len);
data += (read_bytes - before_read_bytes); data += (read_bytes - before_read_bytes);
before_read_bytes = read_bytes;
parse_sctring(&dbi_ex_header->objName, (unsigned char *)data, &read_bytes, max_len); parse_sctring(&dbi_ex_header->objName, (unsigned char *)data, &read_bytes, max_len);
data += (read_bytes - before_read_bytes);
return read_bytes; return read_bytes;
} }

View File

@ -1914,7 +1914,7 @@ R_API int r_core_anal_esil_fcn(RCore *core, ut64 at, ut64 from, int reftype, int
} }
esil = R_STRBUF_SAFEGET (&op->esil); esil = R_STRBUF_SAFEGET (&op->esil);
eprintf ("0x%08"PFMT64x" %d %s\n", at, op->size, esil); eprintf ("0x%08"PFMT64x" %d %s\n", at, op->size, esil);
at += op->size; // at += op->size;
// esilIsRet() // esilIsRet()
// esilIsCall() // esilIsCall()
// esilIsJmp() // esilIsJmp()

View File

@ -1901,14 +1901,13 @@ R_API void r_core_autocomplete(R_NULLABLE RCore *core, RLineCompletion *completi
SdbList *sls = sdb_foreach_list (core->print->formats, false); SdbList *sls = sdb_foreach_list (core->print->formats, false);
SdbListIter *iter; SdbListIter *iter;
SdbKv *kv; SdbKv *kv;
int j = 0;
ls_foreach (sls, iter, kv) { ls_foreach (sls, iter, kv) {
int len = strlen (buf->data + chr); int len = strlen (buf->data + chr);
int minlen = R_MIN (len, strlen (sdbkv_key (kv))); int minlen = R_MIN (len, strlen (sdbkv_key (kv)));
if (!len || !strncmp (buf->data + chr, sdbkv_key (kv), minlen)) { if (!len || !strncmp (buf->data + chr, sdbkv_key (kv), minlen)) {
char *p = strchr (buf->data + chr, '.'); char *p = strchr (buf->data + chr, '.');
if (p) { if (p) {
j += autocomplete_pfele (core, completion, sdbkv_key (kv), pfx, j, p + 1); autocomplete_pfele (core, completion, sdbkv_key (kv), pfx, 0, p + 1);
break; break;
} else { } else {
char *s = r_str_newf ("pf%s.%s", pfx, sdbkv_key (kv)); char *s = r_str_newf ("pf%s.%s", pfx, sdbkv_key (kv));

View File

@ -3630,10 +3630,6 @@ static void ds_align_comment(RDisasmState *ds) {
static void ds_print_dwarf(RDisasmState *ds) { static void ds_print_dwarf(RDisasmState *ds) {
if (ds->show_dwarf) { if (ds->show_dwarf) {
int len = ds->opstr? strlen (ds->opstr): 0;
if (len < 30) {
len = 30 - len;
}
// TODO: cache value in ds // TODO: cache value in ds
int dwarfFile = (int)ds->dwarfFile + (int)ds->dwarfAbspath; int dwarfFile = (int)ds->dwarfFile + (int)ds->dwarfAbspath;
free (ds->sl); free (ds->sl);

View File

@ -182,8 +182,6 @@ static void GH(jemalloc_get_chunks)(RCore *core, const char *input) {
return; return;
} }
input += 1;
if (GH(r_resolve_jemalloc) (core, "je_arenas", &sym)) { if (GH(r_resolve_jemalloc) (core, "je_arenas", &sym)) {
r_io_read_at (core->io, sym, (ut8 *)&arenas, sizeof (GHT)); r_io_read_at (core->io, sym, (ut8 *)&arenas, sizeof (GHT));
for (;;) { for (;;) {

View File

@ -6124,7 +6124,6 @@ R_API bool r_core_panels_load(RCore *core, const char *_name) {
} }
tmp_cfg += strlen (tmp_cfg) + 1; tmp_cfg += strlen (tmp_cfg) + 1;
} }
p_cfg += strlen (p_cfg) + 1;
free (panels_config); free (panels_config);
if (!panels->n_panels) { if (!panels->n_panels) {
free (tmp_cfg); free (tmp_cfg);

View File

@ -3038,8 +3038,7 @@ R_API int r_core_visual_cmd(RCore *core, const char *arg) {
ut64 addr = UT64_MAX; ut64 addr = UT64_MAX;
if (isDisasmPrint (core->printidx)) { if (isDisasmPrint (core->printidx)) {
if (core->print->screen_bounds == core->offset) { if (core->print->screen_bounds == core->offset) {
ut64 addr = core->print->screen_bounds; r_asm_disassemble (core->rasm, &op, core->block, 32);
addr += r_asm_disassemble (core->rasm, &op, core->block, 32);
} }
if (addr == core->offset || addr == UT64_MAX) { if (addr == core->offset || addr == UT64_MAX) {
addr = core->offset + 48; addr = core->offset + 48;

View File

@ -401,7 +401,6 @@ R_API char *r_buf_get_string(RBuffer *b, ut64 addr) {
while (r > 0) { while (r > 0) {
const ut8 *needle = r_mem_mem (res + sz, r, (ut8 *)"\x00", 1); const ut8 *needle = r_mem_mem (res + sz, r, (ut8 *)"\x00", 1);
if (needle) { if (needle) {
sz += (needle - (res + sz));
null_found = true; null_found = true;
break; break;
} }