Skip to content

Commit

Permalink
Minor optimizations in -a and -b
Browse files Browse the repository at this point in the history
  • Loading branch information
radare authored and trufae committed Oct 24, 2023
1 parent d73ca8e commit 0cd8b5c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions libr/core/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1844,10 +1844,11 @@ static int cmd_stdin(void *data, const char *input) {
break;
case 'a': // "-a"
if (R_STR_ISEMPTY (arg)) {
r_core_cmd0 (core, "e asm.arch");
const char *arch = r_config_get (core->config, "asm.arch");
r_cons_printf ("%s\n", arch);
} else {
r_core_cmdf (core, "'e asm.arch=%s", arg);
r_core_cmdf (core, "'e anal.arch=%s", arg);
r_config_set (core->config, "asm.arch", arg);
r_config_set (core->config, "anal.arch", arg);
}
break;
case 'i': // "-i"
Expand All @@ -1861,9 +1862,10 @@ static int cmd_stdin(void *data, const char *input) {
break;
case 'b': // "-b"
if (R_STR_ISEMPTY (arg)) {
r_core_cmdf (core, "e asm.bits");
const int bits = r_config_get_i (core->config, "asm.bits");
r_cons_printf ("%d\n", bits);
} else {
r_core_cmdf (core, "e asm.bits=%s", arg);
r_config_set_i (core->config, "asm.bits", r_num_math (core->num, arg));
}
break;
case 'j': // "-j"
Expand All @@ -1874,7 +1876,7 @@ static int cmd_stdin(void *data, const char *input) {
break;
case 'e': // "-e"
if (*arg == '?') {
r_core_cmd0 (core, "e");
r_core_cmd_call (core, "e");
} else {
r_core_cmdf (core, "e %s", arg);
}
Expand Down

0 comments on commit 0cd8b5c

Please sign in to comment.