Skip to content

Commit f5dbc2f

Browse files
committed
Kill iscommand bloat in esil/esil.c
1 parent d03e7f3 commit f5dbc2f

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

libr/esil/esil.c

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3723,15 +3723,6 @@ static bool esil_float_sqrt(REsil *esil) {
37233723
return ret;
37243724
}
37253725

3726-
static bool iscommand(REsil *esil, const char *word, REsilOp **op) {
3727-
REsilOp *eop = r_esil_get_op (esil, word);
3728-
if (eop) {
3729-
*op = eop;
3730-
return true;
3731-
}
3732-
return false;
3733-
}
3734-
37353726
static bool runword(REsil *esil, const char *word) {
37363727
REsilOp *op = NULL;
37373728
if (!word) {
@@ -3764,24 +3755,23 @@ static bool runword(REsil *esil, const char *word) {
37643755
return true;
37653756
}
37663757

3767-
if (iscommand (esil, word, &op)) {
3758+
op = r_esil_get_op (esil, word);
3759+
if (op) {
37683760
// run action
3769-
if (op) {
3770-
if (esil->cb.hook_command) {
3771-
if (esil->cb.hook_command (esil, word)) {
3772-
return 1; // XXX cannot return != 1
3773-
}
3774-
}
3775-
esil->current_opstr = strdup (word);
3776-
// so this is basically just sharing what's the
3777-
// operation with the operation useful for wrappers
3778-
const bool ret = op->code (esil);
3779-
R_FREE (esil->current_opstr);
3780-
if (!ret) {
3781-
R_LOG_DEBUG ("%s returned 0", word);
3761+
if (esil->cb.hook_command) {
3762+
if (esil->cb.hook_command (esil, word)) {
3763+
return 1; // XXX cannot return != 1
37823764
}
3783-
return ret;
37843765
}
3766+
esil->current_opstr = strdup (word);
3767+
// so this is basically just sharing what's the
3768+
// operation with the operation useful for wrappers
3769+
const bool ret = op->code (esil);
3770+
R_FREE (esil->current_opstr);
3771+
if (!ret) {
3772+
R_LOG_DEBUG ("%s returned 0", word);
3773+
}
3774+
return ret;
37853775
}
37863776
if (!*word || *word == ',') {
37873777
// skip empty words

0 commit comments

Comments
 (0)