summaryrefslogtreecommitdiff
path: root/src/base/refcnt.hh
diff options
context:
space:
mode:
authorNathan Binkert <binkertn@umich.edu>2006-12-27 10:52:25 -0800
committerNathan Binkert <binkertn@umich.edu>2006-12-27 10:52:25 -0800
commit9e90bfafb5b464dacc983c1c513f264d538bd9fd (patch)
tree3443d2e66d3a8ad4eba7eb23910e2861c6cf4695 /src/base/refcnt.hh
parent0bd751848096d7446075e4c8aec43b1798deda67 (diff)
downloadgem5-9e90bfafb5b464dacc983c1c513f264d538bd9fd.tar.xz
No need to use NULL, just use 0
The result of operator= cannot be an l-value --HG-- extra : convert_revision : df97a57f466e3498bd5a29638cb9912c7f3e1bd4
Diffstat (limited to 'src/base/refcnt.hh')
-rw-r--r--src/base/refcnt.hh14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/base/refcnt.hh b/src/base/refcnt.hh
index 6672d4a5f..d1663ad72 100644
--- a/src/base/refcnt.hh
+++ b/src/base/refcnt.hh
@@ -28,10 +28,8 @@
* Authors: Nathan Binkert
*/
-#ifndef __REFCNT_HH__
-#define __REFCNT_HH__
-
-#include <stddef.h> //For the NULL macro definition
+#ifndef __BASE_REFCNT_HH__
+#define __BASE_REFCNT_HH__
class RefCounted
{
@@ -77,7 +75,7 @@ class RefCountingPtr
public:
- RefCountingPtr() : data(NULL) {}
+ RefCountingPtr() : data(0) {}
RefCountingPtr(T *data) { copy(data); }
RefCountingPtr(const RefCountingPtr &r) { copy(r.data); }
~RefCountingPtr() { del(); }
@@ -90,8 +88,8 @@ class RefCountingPtr
const T &operator*() const { return *data; }
const T *get() const { return data; }
- RefCountingPtr &operator=(T *p) { set(p); return *this; }
- RefCountingPtr &operator=(const RefCountingPtr &r)
+ const RefCountingPtr &operator=(T *p) { set(p); return *this; }
+ const RefCountingPtr &operator=(const RefCountingPtr &r)
{ return operator=(r.data); }
bool operator!() const { return data == 0; }
@@ -122,4 +120,4 @@ template<class T>
bool operator!=(const T &l, const RefCountingPtr<T> &r)
{ return l != r.get(); }
-#endif // __REFCNT_HH__
+#endif // __BASE_REFCNT_HH__