summaryrefslogtreecommitdiff
path: root/src/dev/sinic.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/sinic.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/sinic.cc')
-rw-r--r--src/dev/sinic.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dev/sinic.cc b/src/dev/sinic.cc
index 7da70c482..798fb17ef 100644
--- a/src/dev/sinic.cc
+++ b/src/dev/sinic.cc
@@ -1056,7 +1056,7 @@ Device::txKick()
assert(Regs::get_TxDone_Busy(vnic->TxDone));
if (!txPacket) {
// Grab a new packet from the fifo.
- txPacket = new EthPacketData(16384);
+ txPacket = make_shared<EthPacketData>(16384);
txPacketOffset = 0;
}
@@ -1403,7 +1403,7 @@ Device::serialize(std::ostream &os)
SERIALIZE_SCALAR(txState);
SERIALIZE_SCALAR(txFull);
txFifo.serialize("txFifo", os);
- bool txPacketExists = txPacket;
+ bool txPacketExists = txPacket != nullptr;
SERIALIZE_SCALAR(txPacketExists);
if (txPacketExists) {
txPacket->serialize("txPacket", os);
@@ -1498,7 +1498,7 @@ Device::unserialize(Checkpoint *cp, const std::string &section)
UNSERIALIZE_SCALAR(txPacketExists);
txPacket = 0;
if (txPacketExists) {
- txPacket = new EthPacketData(16384);
+ txPacket = make_shared<EthPacketData>(16384);
txPacket->unserialize("txPacket", cp, section);
UNSERIALIZE_SCALAR(txPacketOffset);
UNSERIALIZE_SCALAR(txPacketBytes);