Skip to content

Commit 1c61dae

Browse files
radaretrufae
authored andcommitted
Minor graph performance improvements
1 parent 1e0e438 commit 1c61dae

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

libr/core/agraph.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ static int dist_nodes(const RAGraph *g, const RGraphNode *a, const RGraphNode *b
970970
const RGraphNode *next = g->layers[aa->layer].nodes[i + 1];
971971
const RANode *anext = get_anode (next);
972972
const RANode *acur = get_anode (cur);
973-
int found = false;
973+
bool found = false;
974974

975975
if (g->dists) {
976976
d.from = cur;
@@ -2468,29 +2468,29 @@ static void add_child(RCore *core, RAGraph *g, RANode *u, ut64 jump) {
24682468
bool hl = sdb_exists (core->sdb, key);
24692469
r_agraph_add_edge (g, u, v, hl);
24702470
} else {
2471-
R_LOG_WARN ("Failed to add child node 0x%" PFMT64x " to %s, child not found", jump, u->title);
2471+
R_LOG_WARN ("Failed to add child node 0x%" PFMT64x " to %s, child not found", jump, u? u->title: "?");
24722472
}
24732473
free (title);
24742474
}
24752475

24762476
/* build the RGraph inside the RAGraph g, starting from the Basic Blocks */
24772477
static int get_bbnodes(RAGraph *g, RCore *core, RAnalFunction *fcn) {
2478+
if (!fcn) {
2479+
return false;
2480+
}
24782481
RAnalBlock *bb;
24792482
RListIter *iter;
24802483
char *shortcut = NULL;
24812484
int shortcuts = 0;
2482-
bool emu = r_config_get_b (core->config, "asm.emu");
2483-
bool few = r_config_get_b (core->config, "graph.few");
24842485
int ret = false;
24852486
ut64 saved_gp = core->anal->gp;
24862487
int saved_arena_size = 0;
24872488
ut8 *saved_arena = NULL;
2488-
int saved_stackptr = core->anal->stackptr;
24892489
core->keep_asmqjmps = false;
2490+
const int saved_stackptr = core->anal->stackptr;
2491+
const bool few = r_config_get_b (core->config, "graph.few");
24902492

2491-
if (!fcn) {
2492-
return false;
2493-
}
2493+
const bool emu = r_config_get_b (core->config, "asm.emu");
24942494
if (emu) {
24952495
saved_arena = r_reg_arena_peek (core->anal->reg, &saved_arena_size);
24962496
}
@@ -4259,7 +4259,7 @@ static void goto_asmqjmps(RAGraph *g, RCore *core) {
42594259
r_cons_set_raw (true);
42604260
char ch = r_cons_readchar ();
42614261
obuf[i++] = ch;
4262-
r_cons_printf ("%c", ch);
4262+
r_cons_write (&ch, 1);
42634263
cont = isalpha ((ut8) ch) && !islower ((ut8) ch);
42644264
} while (i < R_CORE_ASMQJMPS_LEN_LETTERS && cont);
42654265
r_cons_flush ();

0 commit comments

Comments
 (0)