Skip to content

Commit 7e7445f

Browse files
author
Daniel Kroening
committed
consolidate the two variants of show-goto-functions
1 parent b821258 commit 7e7445f

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

src/goto-programs/show_goto_functions.cpp

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,32 +52,27 @@ void show_goto_functions(
5252
break;
5353

5454
case ui_message_handlert::uit::PLAIN:
55-
if(list_only)
5655
{
5756
for(const auto &fun : goto_functions.function_map)
5857
{
5958
const symbolt &symbol = ns.lookup(fun.first);
60-
msg.status() << '\n'
61-
<< symbol.display_name() << " /* " << symbol.name
62-
<< (fun.second.body_available() ? ""
63-
: ", body not available")
64-
<< " */";
65-
msg.status() << messaget::eom;
66-
}
67-
}
68-
else
69-
{
70-
auto &out = msg.status();
71-
for(const auto &fun : goto_functions.function_map)
72-
{
73-
if(fun.second.body_available())
59+
const bool has_body = fun.second.body_available();
60+
61+
if(list_only)
62+
{
63+
msg.status() << '\n'
64+
<< symbol.display_name() << " /* " << symbol.name
65+
<< (has_body ? "" : ", body not available") << " */";
66+
msg.status() << messaget::eom;
67+
}
68+
else if(has_body)
7469
{
75-
out << "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n";
70+
msg.status() << "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n";
7671

7772
const symbolt &symbol = ns.lookup(fun.first);
78-
out << messaget::bold << symbol.display_name() << messaget::reset
79-
<< " /* " << symbol.name << " */\n";
80-
fun.second.body.output(ns, symbol.name, out);
73+
msg.status() << messaget::bold << symbol.display_name()
74+
<< messaget::reset << " /* " << symbol.name << " */\n";
75+
fun.second.body.output(ns, symbol.name, msg.status());
8176
msg.status() << messaget::eom;
8277
}
8378
}

0 commit comments

Comments
 (0)