From 2fc414578985b59c5bfbb15103f3c3677a1c6fdc Mon Sep 17 00:00:00 2001
From: Marcus Müller <mueller@kit.edu>
Date: Tue, 20 Feb 2018 15:47:12 +0100
Subject: blocks: don't pmt::mp("string") for every single PDU
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Replaced the usage of `#define PDU_PORT_ID pmt::mp("pdus")` – that was
the actual way to *enforce* rehashing on every single use.

Now, static const member of namespace `gr::blocks::pdu` as
`s_pdu_port_id`. Should speed up the PDU blocks a bit. Removes run-time
malloc'ing. Good thing.
---
 gr-blocks/lib/tcp_connection.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'gr-blocks/lib/tcp_connection.cc')

diff --git a/gr-blocks/lib/tcp_connection.cc b/gr-blocks/lib/tcp_connection.cc
index 200e82b89f..4dba1e9edc 100644
--- a/gr-blocks/lib/tcp_connection.cc
+++ b/gr-blocks/lib/tcp_connection.cc
@@ -94,7 +94,7 @@ namespace gr {
           pmt::pmt_t vector = pmt::init_u8vector(bytes_transferred, (const uint8_t*)&d_buf[0]);
           pmt::pmt_t pdu = pmt::cons(pmt::PMT_NIL, vector);
 
-          d_block->message_port_pub(PDU_PORT_ID, pdu);
+          d_block->message_port_pub(pdu::s_pdu_port_id, pdu);
         }
 
         d_socket.async_read_some(boost::asio::buffer(d_buf),
-- 
cgit v1.2.3