mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-08 11:23:27 +00:00
Little code cleanups/var scope reductions
This commit is contained in:
parent
35a5c42a52
commit
c48d474fa8
@ -90,11 +90,6 @@ static const char *ops_biti[] = {
|
||||
[0x2] = "tbit",
|
||||
};
|
||||
|
||||
static inline ut8 cr16_get_opcode_biti(const ut8 instr)
|
||||
{
|
||||
return (instr >> 6) & 0x3;
|
||||
}
|
||||
|
||||
static inline ut8 cr16_get_opcode_low(const ut16 instr)
|
||||
{
|
||||
return (instr >> 9) & 0xF;
|
||||
@ -139,14 +134,6 @@ static inline ut16 cr16_get_opcode_159_0(const ut16 opc)
|
||||
return (opc & 1) | ((opc >> 8) & 0xFE);
|
||||
}
|
||||
|
||||
static inline int cr16_check_biti_boundaries(const ut8 opcode)
|
||||
{
|
||||
if (opcode >= sizeof(ops_biti)/sizeof(void*) || !ops_biti[opcode]) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int cr16_check_reg_boundaries(const ut8 reg)
|
||||
{
|
||||
if (reg >= sizeof(cr16_regs_names)/sizeof(void*)
|
||||
@ -222,21 +209,6 @@ static inline int cr16_print_reg_med(struct cr16_cmd *cmd, ut16 med, ut8 reg)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int cr16_print_biti_opcode(struct cr16_cmd *cmd, ut16 instr)
|
||||
{
|
||||
ut8 opcode = cr16_get_opcode_biti(instr);
|
||||
|
||||
if (cr16_check_biti_boundaries(opcode)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
snprintf(cmd->instr, CR16_INSTR_MAXLEN - 1, "%s%c",
|
||||
ops_biti[opcode],
|
||||
cr16_get_opcode_i(instr) ? 'w' : 'b');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int cr16_print_short_abs18(struct cr16_cmd *cmd,
|
||||
ut8 sh, ut32 abs) {
|
||||
snprintf(cmd->operands, CR16_INSTR_MAXLEN - 1,
|
||||
|
@ -2529,8 +2529,6 @@ static int bin_fields(RCore *r, int mode, int va) {
|
||||
int i = 0;
|
||||
RBin *bin = r->bin;
|
||||
RBinFile *binfile = r_core_bin_cur (r);
|
||||
ut64 size = binfile ? binfile->size : UT64_MAX;
|
||||
ut64 baddr = r_bin_get_baddr (r->bin);
|
||||
|
||||
if (!(fields = r_bin_get_fields (bin))) {
|
||||
return false;
|
||||
@ -2548,6 +2546,8 @@ static int bin_fields(RCore *r, int mode, int va) {
|
||||
else if (IS_MODE_SET (mode)) {
|
||||
// XXX: Need more flags??
|
||||
// this will be set even if the binary does not have an ehdr
|
||||
ut64 size = binfile ? binfile->size : UT64_MAX;
|
||||
ut64 baddr = r_bin_get_baddr (r->bin);
|
||||
int fd = r_core_file_cur_fd(r);
|
||||
r_io_section_add (r->io, 0, baddr, size, size, 7, "ehdr", 0, fd);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user