summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Habets <thomas@habets.se>2020-08-12 12:00:20 +0100
committerMartin Braun <martin@gnuradio.org>2020-08-14 04:08:48 -0700
commitd91deff6b6c81d8a6d793b370bc68eb670e6364e (patch)
tree664b515a451b8b4e710f0e336ab0c1509e94d6d5
parent25e1d2aa99a5f60cc047f6009715925d3a6a01ca (diff)
digital/crc32_async: Remove manual memory management
-rw-r--r--gr-digital/lib/crc32_async_bb_impl.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/gr-digital/lib/crc32_async_bb_impl.cc b/gr-digital/lib/crc32_async_bb_impl.cc
index 90851f7b72..eebca4ac6c 100644
--- a/gr-digital/lib/crc32_async_bb_impl.cc
+++ b/gr-digital/lib/crc32_async_bb_impl.cc
@@ -52,23 +52,21 @@ void crc32_async_bb_impl::calc(pmt::pmt_t msg)
unsigned int crc;
size_t pkt_len(0);
const uint8_t* bytes_in = pmt::u8vector_elements(bytes, pkt_len);
- uint8_t* bytes_out =
- (uint8_t*)volk_malloc(4 + pkt_len * sizeof(uint8_t), volk_get_alignment());
+ std::vector<uint8_t> bytes_out(4 + pkt_len);
d_crc_impl.reset();
d_crc_impl.process_bytes(bytes_in, pkt_len);
crc = d_crc_impl();
- memcpy((void*)bytes_out, (const void*)bytes_in, pkt_len);
- memcpy((void*)(bytes_out + pkt_len),
+ memcpy((void*)bytes_out.data(), (const void*)bytes_in, pkt_len);
+ memcpy((void*)(bytes_out.data() + pkt_len),
&crc,
4); // FIXME big-endian/little-endian, this might be wrong
pmt::pmt_t output = pmt::init_u8vector(
pkt_len + 4,
- bytes_out); // this copies the values from bytes_out into the u8vector
+ bytes_out.data()); // this copies the values from bytes_out into the u8vector
pmt::pmt_t msg_pair = pmt::cons(meta, output);
message_port_pub(d_out_port, msg_pair);
- volk_free(bytes_out);
}
void crc32_async_bb_impl::check(pmt::pmt_t msg)