From ad3f75dc81efc8818786c32d6190e3ed069b9fc6 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Thu, 16 Oct 2014 05:49:46 -0400 Subject: dev: Use shared_ptr for EthPacketData This patch transitions the EthPacketData from the ad-hoc RefCountingPtr to the c++11 shared_ptr. There are no changes in behaviour, and the code modifications are mainly replacing "new" with "make_shared". The bool casting operator for the shared_ptr is explicit, and we must therefore either cast it, compare it to NULL (p != nullptr), double negate it (!!p) or do a (p ? true : false). --- src/dev/ethertap.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/dev/ethertap.cc') diff --git a/src/dev/ethertap.cc b/src/dev/ethertap.cc index e14fd90c2..38ce4a2b3 100644 --- a/src/dev/ethertap.cc +++ b/src/dev/ethertap.cc @@ -235,7 +235,7 @@ EtherTap::process(int revent) while (data_len != 0 && buffer_offset >= data_len + sizeof(uint32_t)) { EthPacketPtr packet; - packet = new EthPacketData(data_len); + packet = make_shared(data_len); packet->length = data_len; memcpy(packet->data, data, data_len); -- cgit v1.2.3