Skip to content

Commit

Permalink
Kill unused esil macro
Browse files Browse the repository at this point in the history
  • Loading branch information
condret committed Dec 3, 2024
1 parent 2f27b50 commit ec35bbf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 80 deletions.
83 changes: 4 additions & 79 deletions libr/esil/esil.c
Original file line number Diff line number Diff line change
Expand Up @@ -2220,65 +2220,6 @@ static bool esil_add(REsil *esil) {
return ret;
}

#if ESIL_MACRO
static bool esil_inc_macro(REsil *esil) {
bool ret = false;
char *src = r_esil_pop (esil);
if (R_STR_ISNOTEMPTY (src)) {
r_esil_runpending (esil, r_str_newf ("1,%s,+", src));
ret = true;
} else {
R_LOG_DEBUG ("esil_inc: invalid parameters");
}
free (src);
return ret;
}

static bool esil_inceq_macro(REsil *esil) {
bool ret = false;
char *src = r_esil_pop (esil);
if (R_STR_ISNOTEMPTY (src)) {
r_esil_runpending (esil, r_str_newf ("1,%s,+,%s,=", src, src));
ret = true;
} else {
R_LOG_DEBUG ("esil_inceq_macro: invalid parameters");
}
free (src);
return ret;
}

#if 0
static bool esil_addeq_macro(REsil *esil) {
bool ret = false;
char *dst = r_esil_pop (esil);
char *src = r_esil_pop (esil);
if (R_STR_ISNOTEMPTY (src) && R_STR_ISNOTEMPTY (dst)) {
r_esil_runpending (esil, r_str_newf ("%s,%s,+,%s,=", src, dst, dst));
ret = true;
} else {
R_LOG_DEBUG ("esil_addeq_macro: invalid parameters");
}
free (src);
free (dst);
return ret;
}

static bool esil_subeq_macro(REsil *esil) {
bool ret = false;
char *dst = r_esil_pop (esil);
char *src = r_esil_pop (esil);
if (R_STR_ISNOTEMPTY (src) && R_STR_ISNOTEMPTY (dst)) {
r_esil_runpending (esil, r_str_newf ("%s,%s,-,%s,=", src, dst, dst));
ret = true;
} else {
R_LOG_DEBUG ("esil_subeq_macro: invalid parameters");
}
free (src);
free (dst);
return ret;
}
#endif
#else
static bool esil_inc(REsil *esil) {
bool ret = false;
ut64 s;
Expand Down Expand Up @@ -2311,8 +2252,6 @@ static bool esil_inceq(REsil *esil) {
return ret;
}

#endif

static bool esil_addeq(REsil *esil) {
bool ret = false;
ut64 s, d;
Expand Down Expand Up @@ -4090,23 +4029,6 @@ R_API int r_esil_condition(REsil *esil, const char *str) {
#define OT_FLAG R_ESIL_OP_TYPE_FLAG
#define OT_TRAP R_ESIL_OP_TYPE_TRAP

R_API void r_esil_setup_macros(REsil *esil) {
R_RETURN_IF_FAIL (esil);
#if ESIL_MACRO
OP ("++", esil_inc_macro, 1, 1, OT_MATH);
OP ("++=", esil_inceq_macro, 1, 1, OT_MATH);
// OP ("+=", esil_addeq_macro, 0, 2, OT_MATH | OT_REGW);
// OP ("-=", esil_subeq_macro, 0, 2, OT_MATH | OT_REGW);
OP ("+=", esil_addeq, 0, 2, OT_MATH | OT_REGW);
OP ("-=", esil_subeq, 0, 2, OT_MATH | OT_REGW);
#else
OP ("++", esil_inc, 0, 1, OT_MATH | OT_REGW);
OP ("++=", esil_inceq, 0, 1, OT_MATH | OT_REGW);
OP ("+=", esil_addeq, 0, 2, OT_MATH | OT_REGW);
OP ("-=", esil_subeq, 0, 2, OT_MATH | OT_REGW);
#endif
}

R_API bool r_esil_setup_ops(REsil *esil) {
R_RETURN_VAL_IF_FAIL (esil, false);
bool ret = OP ("$", esil_interrupt, 0, 1, OT_UNK); // hm, type seems a bit wrong
Expand Down Expand Up @@ -4156,7 +4078,11 @@ R_API bool r_esil_setup_ops(REsil *esil) {
ret &= OP ("^", esil_xor, 1, 2, OT_MATH);
ret &= OP ("^=", esil_xoreq, 0, 2, OT_MATH | OT_REGW);
ret &= OP ("+", esil_add, 1, 2, OT_MATH);
ret &= OP ("+=", esil_addeq, 0, 2, OT_MATH | OT_REGW);
ret &= OP ("++", esil_inc, 0, 1, OT_MATH | OT_REGW);
ret &= OP ("++=", esil_inceq, 0, 1, OT_MATH | OT_REGW);
ret &= OP ("-", esil_sub, 1, 2, OT_MATH);
ret &= OP ("-=", esil_subeq, 0, 2, OT_MATH | OT_REGW);
ret &= OP ("--", esil_dec, 1, 1, OT_MATH);
ret &= OP ("--=", esil_deceq, 0, 1, OT_MATH | OT_REGW);
ret &= OP ("/", esil_div, 1, 2, OT_MATH);
Expand Down Expand Up @@ -4291,7 +4217,6 @@ R_API bool r_esil_setup(REsil *esil, RAnal *anal, bool romem, bool stats, bool n
}
r_esil_mem_ro (esil, romem);
r_esil_stats (esil, stats);
r_esil_setup_macros (esil);
r_esil_setup_ops (esil);

// Try arch esil init cb first, then anal as fallback
Expand Down
1 change: 0 additions & 1 deletion libr/include/r_esil.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ R_API void r_esil_del_voyeur(REsil *esil, st32 vid);
R_API void r_esil_reset(REsil *esil);
R_API void r_esil_set_pc(REsil *esil, ut64 addr);
R_API bool r_esil_setup(REsil *esil, struct r_anal_t *anal, bool romem, bool stats, bool nonull);
R_API void r_esil_setup_macros(REsil *esil);
R_API bool r_esil_setup_ops(REsil *esil);
R_API void r_esil_fini(REsil *esil);
R_API void r_esil_free(REsil *esil);
Expand Down

0 comments on commit ec35bbf

Please sign in to comment.