You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@locus.apache.org on 2000/12/21 05:25:34 UTC
cvs commit: xml-xalan/c/src/Include XalanAutoPtr.hpp
dbertoni 00/12/20 20:25:34
Modified: c/src/Include XalanAutoPtr.hpp
Log:
Added some special-case checks for null for better performance under Win32.
Revision Changes Path
1.2 +37 -7 xml-xalan/c/src/Include/XalanAutoPtr.hpp
Index: XalanAutoPtr.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/Include/XalanAutoPtr.hpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XalanAutoPtr.hpp 2000/11/02 01:42:09 1.1
+++ XalanAutoPtr.hpp 2000/12/21 04:25:33 1.2
@@ -91,7 +91,14 @@
{
if (this != &theRHS)
{
- delete m_pointer;
+ // This test ought not to be necessary, but
+ // MSVC 6.0 calls delete, which checks for 0.
+ // The problem with that is the locking is
+ // extremely expensive.
+ if (m_pointer != 0)
+ {
+ delete m_pointer;
+ }
m_pointer = theRHS.release();
}
@@ -101,7 +108,11 @@
~XalanAutoPtr()
{
- delete m_pointer;
+ // See note in operator=() about this...
+ if (m_pointer != 0)
+ {
+ delete m_pointer;
+ }
}
Type&
@@ -135,7 +146,11 @@
void
reset(Type* thePointer = 0)
{
- delete m_pointer;
+ // See note in operator=() about this...
+ if (m_pointer != 0)
+ {
+ delete m_pointer;
+ }
m_pointer = thePointer;
}
@@ -168,7 +183,14 @@
{
if (this != &theRHS)
{
- delete [] m_pointer;
+ // This test ought not to be necessary, but
+ // MSVC 6.0 calls delete, which checks for 0.
+ // The problem with that is the locking is
+ // extremely expensive.
+ if (m_pointer != 0)
+ {
+ delete [] m_pointer;
+ }
m_pointer = theRHS.release();
}
@@ -178,7 +200,11 @@
~XalanArrayAutoPtr()
{
- delete [] m_pointer;
+ // See note in operator=() about this...
+ if (m_pointer != 0)
+ {
+ delete [] m_pointer;
+ }
}
Type&
@@ -188,7 +214,7 @@
}
Type&
- operator[] (size_t index) const
+ operator[](size_t index) const
{
return m_pointer[index];
}
@@ -212,7 +238,11 @@
void
reset(Type* thePointer = 0)
{
- delete [] m_pointer;
+ // See note in operator=() about this...
+ if (m_pointer != 0)
+ {
+ delete [] m_pointer;
+ }
m_pointer = thePointer;
}