summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mem/ruby/common/DataBlock.cc10
-rw-r--r--src/mem/ruby/common/DataBlock.hh2
2 files changed, 3 insertions, 9 deletions
diff --git a/src/mem/ruby/common/DataBlock.cc b/src/mem/ruby/common/DataBlock.cc
index 5aba4332a..59a0f692a 100644
--- a/src/mem/ruby/common/DataBlock.cc
+++ b/src/mem/ruby/common/DataBlock.cc
@@ -87,14 +87,6 @@ DataBlock::setData(uint8* data, int offset, int len)
DataBlock &
DataBlock::operator=(const DataBlock & obj)
{
- if (this == &obj) {
- // assert(false);
- } else {
- if (!m_alloc)
- m_data = new uint8[RubySystem::getBlockSizeBytes()];
- memcpy(m_data, obj.m_data, RubySystem::getBlockSizeBytes());
- m_alloc = true;
- }
-
+ memcpy(m_data, obj.m_data, RubySystem::getBlockSizeBytes());
return *this;
}
diff --git a/src/mem/ruby/common/DataBlock.hh b/src/mem/ruby/common/DataBlock.hh
index 7bd92710d..0ab4cfc01 100644
--- a/src/mem/ruby/common/DataBlock.hh
+++ b/src/mem/ruby/common/DataBlock.hh
@@ -29,6 +29,7 @@
#ifndef __MEM_RUBY_COMMON_DATABLOCK_HH__
#define __MEM_RUBY_COMMON_DATABLOCK_HH__
+#include <cassert>
#include <iomanip>
#include <iostream>
@@ -72,6 +73,7 @@ class DataBlock
inline void
DataBlock::assign(uint8* data)
{
+ assert(data != NULL);
if (m_alloc) {
delete [] m_data;
}