Fix #16263 - Do not newline after showing switch cases ##disasm

This commit is contained in:
pancake 2020-03-20 13:54:04 +01:00 committed by radare
parent b27910c330
commit fc9a7623fa
1 changed files with 5 additions and 3 deletions

View File

@ -1,11 +1,10 @@
/* radare - LGPL - Copyright 2009-2019 - nibble, pancake, dso */ /* radare - LGPL - Copyright 2009-2020 - nibble, pancake, dso */
#include "r_core.h" #include "r_core.h"
#define HASRETRY 1 #define HASRETRY 1
#define HAVE_LOCALS 1 #define HAVE_LOCALS 1
#define DEFAULT_NARGS 4 #define DEFAULT_NARGS 4
// #define FLAG_PREFIX "; "
#define FLAG_PREFIX ";-- " #define FLAG_PREFIX ";-- "
#define COLOR(ds, field) ((ds)->show_color ? (ds)->field : "") #define COLOR(ds, field) ((ds)->show_color ? (ds)->field : "")
@ -2237,6 +2236,7 @@ static void ds_show_flags(RDisasmState *ds) {
bool outline = !ds->flags_inline; bool outline = !ds->flags_inline;
const char *comma = ""; const char *comma = "";
bool keep_lib = r_config_get_i (core->config, "bin.demangle.libs"); bool keep_lib = r_config_get_i (core->config, "bin.demangle.libs");
bool docolon = true;
int nth = 0; int nth = 0;
r_list_foreach (uniqlist, iter, flag) { r_list_foreach (uniqlist, iter, flag) {
if (f && f->addr == flag->offset && !strcmp (flag->name, f->name)) { if (f && f->addr == flag->offset && !strcmp (flag->name, f->name)) {
@ -2325,6 +2325,8 @@ static void ds_show_flags(RDisasmState *ds) {
case_prev = case_current; case_prev = case_current;
ds_align_comment (ds); ds_align_comment (ds);
r_cons_printf ("%s; from %s", ds->show_color ? ds->pal_comment : "", addr); r_cons_printf ("%s; from %s", ds->show_color ? ds->pal_comment : "", addr);
outline = false;
docolon = false;
} else { } else {
const char *lang = r_config_get (core->config, "bin.lang"); const char *lang = r_config_get (core->config, "bin.lang");
char *name = r_bin_demangle (core->bin->cur, lang, flag->realname, flag->offset, keep_lib); char *name = r_bin_demangle (core->bin->cur, lang, flag->realname, flag->offset, keep_lib);
@ -2365,7 +2367,7 @@ static void ds_show_flags(RDisasmState *ds) {
nth++; nth++;
} }
if (!outline && *comma) { if (!outline && *comma) {
if (nth > 0) { if (nth > 0 && docolon) {
r_cons_printf (":"); r_cons_printf (":");
} }
ds_newline (ds); ds_newline (ds);