summaryrefslogtreecommitdiff
path: root/src/dev/i8254xGBe.cc
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2014-10-16 05:49:46 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2014-10-16 05:49:46 -0400
commitad3f75dc81efc8818786c32d6190e3ed069b9fc6 (patch)
treef3f0e2a55a3fbcd554fb8d4f110e41991de03ae9 /src/dev/i8254xGBe.cc
parent4e67ab6663f8f4960a1078546906746877f87e1a (diff)
downloadgem5-ad3f75dc81efc8818786c32d6190e3ed069b9fc6.tar.xz
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).
Diffstat (limited to 'src/dev/i8254xGBe.cc')
-rw-r--r--src/dev/i8254xGBe.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/dev/i8254xGBe.cc b/src/dev/i8254xGBe.cc
index d86d7b486..af9734761 100644
--- a/src/dev/i8254xGBe.cc
+++ b/src/dev/i8254xGBe.cc
@@ -41,6 +41,7 @@
*/
#include <algorithm>
+#include <memory>
#include "base/inet.hh"
#include "base/trace.hh"
@@ -2147,7 +2148,7 @@ IGbE::txStateMachine()
}
if (!txPacket) {
- txPacket = new EthPacketData(16384);
+ txPacket = std::make_shared<EthPacketData>(16384);
}
if (!txDescCache.packetWaiting()) {
@@ -2469,7 +2470,7 @@ IGbE::serialize(std::ostream &os)
rxFifo.serialize("rxfifo", os);
txFifo.serialize("txfifo", os);
- bool txPktExists = txPacket;
+ bool txPktExists = txPacket != nullptr;
SERIALIZE_SCALAR(txPktExists);
if (txPktExists)
txPacket->serialize("txpacket", os);
@@ -2526,7 +2527,7 @@ IGbE::unserialize(Checkpoint *cp, const std::string &section)
bool txPktExists;
UNSERIALIZE_SCALAR(txPktExists);
if (txPktExists) {
- txPacket = new EthPacketData(16384);
+ txPacket = std::make_shared<EthPacketData>(16384);
txPacket->unserialize("txpacket", cp, section);
}