diff options
author | Marcus Müller <mueller@kit.edu> | 2018-02-20 11:22:14 +0100 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2018-02-23 19:06:50 +0100 |
commit | 97f0d1cecf4a8cb82e8e16e4dfcac0589c5b56c7 (patch) | |
tree | e0ad2aba49c4ebcb8a8bbf9f6b65bc8a953c95e0 /gr-blocks/lib/message_strobe_impl.cc | |
parent | 2fc414578985b59c5bfbb15103f3c3677a1c6fdc (diff) |
blocks: 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-blocks/lib/message_strobe_impl.cc')
-rw-r--r-- | gr-blocks/lib/message_strobe_impl.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gr-blocks/lib/message_strobe_impl.cc b/gr-blocks/lib/message_strobe_impl.cc index 96b079a0ed..059584e636 100644 --- a/gr-blocks/lib/message_strobe_impl.cc +++ b/gr-blocks/lib/message_strobe_impl.cc @@ -51,9 +51,10 @@ namespace gr { io_signature::make(0, 0, 0)), d_finished(false), d_period_ms(period_ms), - d_msg(msg) + d_msg(msg), + d_port(pmt::mp("strobe")) { - message_port_register_out(pmt::mp("strobe")); + message_port_register_out(d_port); message_port_register_in(pmt::mp("set_msg")); set_msg_handler(pmt::mp("set_msg"), @@ -95,7 +96,7 @@ namespace gr { return; } - message_port_pub(pmt::mp("strobe"), d_msg); + message_port_pub(d_port, d_msg); } } |