diff options
author | Thomas Habets <thomas@habets.se> | 2020-04-10 17:40:11 +0100 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-04-11 01:41:39 +0200 |
commit | b5e8a552c09a1b9a1397e731cc6f54d427df9a67 (patch) | |
tree | dc60d92c7f53d5d15cbf42d2c5a2623a557eb7ca /gnuradio-runtime/lib/message.cc | |
parent | 616879745ce5d61e6acd54ad84d60359a739a27d (diff) |
runtime: Remove most manual memory management
The remaining ones:
* `pmt_pool.cc`, which is a memory allocator so that makes sense
* the tricky and aptly named `sptr_magic.cc`.
Diffstat (limited to 'gnuradio-runtime/lib/message.cc')
-rw-r--r-- | gnuradio-runtime/lib/message.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gnuradio-runtime/lib/message.cc b/gnuradio-runtime/lib/message.cc index fa8b1e3e85..ab5130a2d0 100644 --- a/gnuradio-runtime/lib/message.cc +++ b/gnuradio-runtime/lib/message.cc @@ -34,14 +34,13 @@ message::make_from_string(const std::string s, long type, double arg1, double ar } message::message(long type, double arg1, double arg2, size_t length) - : d_type(type), d_arg1(arg1), d_arg2(arg2) + : d_type(type), d_arg1(arg1), d_arg2(arg2), d_buf(length) { if (length == 0) - d_buf_start = d_msg_start = d_msg_end = d_buf_end = 0; + d_msg_start = d_msg_end = nullptr; else { - d_buf_start = new unsigned char[length]; - d_msg_start = d_buf_start; - d_msg_end = d_buf_end = d_buf_start + length; + d_msg_start = d_buf.data(); + d_msg_end = d_msg_start + length; } s_ncurrently_allocated++; } @@ -49,8 +48,6 @@ message::message(long type, double arg1, double arg2, size_t length) message::~message() { assert(d_next == 0); - delete[] d_buf_start; - d_msg_start = d_msg_end = d_buf_end = 0; s_ncurrently_allocated--; } |