[webkit-changes] cvs commit: JavaScriptCore/kxmlcore PassRefPtr.h
RefPtr.h
Darin
darin at opensource.apple.com
Mon Dec 19 12:48:24 PST 2005
darin 05/12/19 12:48:24
Modified: . ChangeLog
kxmlcore PassRefPtr.h RefPtr.h
Log:
Originally done by both George Staikos and Alexey Proskuryakov.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5706
Sharedptr dependency can be removed
Our coding guidelines say "use 0 instead of NULL" and both RefPtr and
PassRefPtr were using NULL, which required including a header that
defines NULL.
* kxmlcore/PassRefPtr.h:
(KXMLCore::PassRefPtr::PassRefPtr): Use 0 instead of NULL.
(KXMLCore::PassRefPtr::operator!): Use ! instead of == NULL.
* kxmlcore/RefPtr.h:
(KXMLCore::RefPtr::RefPtr): Use 0 instead of NULL.
(KXMLCore::RefPtr::operator!): Use ! instead of == NULL.
Also did some reformatting.
Revision Changes Path
1.913 +19 -0 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.912
retrieving revision 1.913
diff -u -r1.912 -r1.913
--- ChangeLog 19 Dec 2005 19:53:06 -0000 1.912
+++ ChangeLog 19 Dec 2005 20:48:21 -0000 1.913
@@ -1,5 +1,24 @@
2005-12-19 Darin Adler <darin at apple.com>
+ Originally done by both George Staikos and Alexey Proskuryakov.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5706
+ Sharedptr dependency can be removed
+
+ Our coding guidelines say "use 0 instead of NULL" and both RefPtr and
+ PassRefPtr were using NULL, which required including a header that
+ defines NULL.
+
+ * kxmlcore/PassRefPtr.h:
+ (KXMLCore::PassRefPtr::PassRefPtr): Use 0 instead of NULL.
+ (KXMLCore::PassRefPtr::operator!): Use ! instead of == NULL.
+ * kxmlcore/RefPtr.h:
+ (KXMLCore::RefPtr::RefPtr): Use 0 instead of NULL.
+ (KXMLCore::RefPtr::operator!): Use ! instead of == NULL.
+ Also did some reformatting.
+
+2005-12-19 Darin Adler <darin at apple.com>
+
Reviewed by Geoff Garen and Eric Seidel.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4923
1.4 +5 -10 JavaScriptCore/kxmlcore/PassRefPtr.h
Index: PassRefPtr.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kxmlcore/PassRefPtr.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PassRefPtr.h 8 Dec 2005 18:19:28 -0000 1.3
+++ PassRefPtr.h 19 Dec 2005 20:48:23 -0000 1.4
@@ -41,7 +41,7 @@
class PassRefPtr
{
public:
- PassRefPtr() : m_ptr(NULL) {}
+ PassRefPtr() : m_ptr(0) {}
PassRefPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }
PassRefPtr(const RefPtr<T>& o) : m_ptr(o.get()) { if (T *ptr = m_ptr) ptr->ref(); }
@@ -64,16 +64,11 @@
T& operator*() const { return *m_ptr; }
T *operator->() const { return m_ptr; }
- bool operator!() const { return m_ptr == NULL; }
+ bool operator!() const { return !m_ptr; }
- // this type conversion operator allows implicit conversion to
- // bool but not to other integer types
-
- typedef T * (PassRefPtr::*UnspecifiedBoolType)() const;
- operator UnspecifiedBoolType() const
- {
- return m_ptr ? &PassRefPtr::get : 0;
- }
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
+ typedef T* (PassRefPtr::*UnspecifiedBoolType)() const;
+ operator UnspecifiedBoolType() const { return m_ptr ? &PassRefPtr::get : 0; }
PassRefPtr& operator=(const RefPtr<T>&);
PassRefPtr& operator=(T *);
1.6 +4 -10 JavaScriptCore/kxmlcore/RefPtr.h
Index: RefPtr.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kxmlcore/RefPtr.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- RefPtr.h 16 Dec 2005 22:27:26 -0000 1.5
+++ RefPtr.h 19 Dec 2005 20:48:23 -0000 1.6
@@ -31,7 +31,7 @@
template <class T> class RefPtr
{
public:
- RefPtr() : m_ptr(NULL) {}
+ RefPtr() : m_ptr(0) {}
RefPtr(T *ptr) : m_ptr(ptr) { if (ptr) ptr->ref(); }
RefPtr(const RefPtr& o) : m_ptr(o.m_ptr) { if (T *ptr = m_ptr) ptr->ref(); }
@@ -44,17 +44,11 @@
T& operator*() const { return *m_ptr; }
T *operator->() const { return m_ptr; }
- bool operator!() const { return m_ptr == NULL; }
-
+ bool operator!() const { return !m_ptr; }
- // this type conversion operator allows implicit conversion to
- // bool but not to other integer types
-
+ // This conversion operator allows implicit conversion to bool but not to other integer types.
typedef T * (RefPtr::*UnspecifiedBoolType)() const;
- operator UnspecifiedBoolType() const
- {
- return m_ptr ? &RefPtr::get : 0;
- }
+ operator UnspecifiedBoolType() const { return m_ptr ? &RefPtr::get : 0; }
RefPtr& operator=(const RefPtr&);
RefPtr& operator=(T *);
More information about the webkit-changes
mailing list