summaryrefslogtreecommitdiff
path: root/gr-qtgui/lib/edit_box_msg_impl.cc
diff options
context:
space:
mode:
authorMarcus Müller <mueller@kit.edu>2018-02-20 13:03:12 +0100
committerMarcus Müller <marcus@hostalia.de>2018-02-23 19:06:50 +0100
commit9b63bb4f4a52c172ea8f4ebf8e0577cf101da69c (patch)
tree51c03403bf33ceb33a29d3e3917082d5bb4bd439 /gr-qtgui/lib/edit_box_msg_impl.cc
parent28401b7a01d9e6f25c6057f7b9dc07c8e568ff60 (diff)
qtgui: remove unnecessary call to pmt::intern at runtime
typical usage: message_port_pub(pmt::mp("out_port"), …) which is bad, as it implies hashing of a string, allocation of memory, deallocation, finding the hashed string in the table of interned strings and returning a unique pointer (which for reasons of PMT awesomeness isn't even unique) to the interned port name. Replacing all these port name ad hoc ::mp() calls by reusing one, private, port name member.
Diffstat (limited to 'gr-qtgui/lib/edit_box_msg_impl.cc')
-rw-r--r--gr-qtgui/lib/edit_box_msg_impl.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/gr-qtgui/lib/edit_box_msg_impl.cc b/gr-qtgui/lib/edit_box_msg_impl.cc
index 084e2d4f34..6dbd54203b 100644
--- a/gr-qtgui/lib/edit_box_msg_impl.cc
+++ b/gr-qtgui/lib/edit_box_msg_impl.cc
@@ -51,7 +51,8 @@ namespace gr {
: block("edit_box_msg",
io_signature::make(0, 0, 0),
io_signature::make(0, 0, 0)),
- QObject(parent)
+ QObject(parent),
+ d_port(pmt::mp("msg"))
{
// Required now for Qt; argc must be greater than 0 and argv
// must have at least one valid character. Must be valid through
@@ -156,7 +157,7 @@ namespace gr {
d_msg = pmt::PMT_NIL;
- message_port_register_out(pmt::mp("msg"));
+ message_port_register_out(d_port);
message_port_register_in(pmt::mp("val"));
set_msg_handler(pmt::mp("val"),
@@ -404,7 +405,7 @@ namespace gr {
// Emit the new message to pass updates downstream.
// Loops are prevented by the early exit if d_msg == val.
- message_port_pub(pmt::mp("msg"), d_msg);
+ message_port_pub(d_port, d_msg);
}
void
@@ -560,7 +561,7 @@ namespace gr {
d_msg = pmt::cons(pmt::intern(key), d_msg);
}
- message_port_pub(pmt::mp("msg"), d_msg);
+ message_port_pub(d_port, d_msg);
}
} /* namespace qtgui */