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/08/22 22:19:01 UTC
cvs commit: xml-xalan/c/src/PlatformSupport ArenaAllocator.hpp ArenaBlock.hpp AttributeListImpl.cpp AttributeListImpl.hpp DOMStringHelper.cpp NamedNodeMapAttributeList.cpp NamedNodeMapAttributeList.hpp ReusableArenaAllocator.hpp ReusableArenaBlock.hpp STLHelper.hpp URISupport.cpp URISupport.hpp XalanNumberFormat.cpp
dbertoni 00/08/22 13:19:00
Modified: c/src/PlatformSupport ArenaAllocator.hpp ArenaBlock.hpp
AttributeListImpl.cpp AttributeListImpl.hpp
DOMStringHelper.cpp NamedNodeMapAttributeList.cpp
NamedNodeMapAttributeList.hpp
ReusableArenaAllocator.hpp ReusableArenaBlock.hpp
STLHelper.hpp URISupport.cpp URISupport.hpp
XalanNumberFormat.cpp
Log:
Changes for AIX port.
Revision Changes Path
1.5 +16 -6 xml-xalan/c/src/PlatformSupport/ArenaAllocator.hpp
Index: ArenaAllocator.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/ArenaAllocator.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ArenaAllocator.hpp 2000/07/11 21:03:31 1.4
+++ ArenaAllocator.hpp 2000/08/22 20:18:48 1.5
@@ -77,25 +77,27 @@
void
operator()(const Type* theType) const
{
+#if defined(XALAN_CANNOT_DELETE_CONST)
+ delete (Type*)theType;
+#else
delete theType;
+#endif
}
};
template<class ObjectType,
- class DestroyFunctionType = ArenaBlockDestroy<ObjectType>,
-#if defined(XALAN_NO_NAMESPACES)
- class AllocatorType = allocator<ObjectType>,
+#if defined(XALAN_NO_DEFAULT_TEMPLATE_ARGUMENTS)
+ class ArenaBlockType>
#else
- class AllocatorType = std::allocator<ObjectType>,
+ class ArenaBlockType = ArenaBlock<ObjectType> >
#endif
- class ArenaBlockType = ArenaBlock<ObjectType, DestroyFunctionType, AllocatorType> >
class ArenaAllocator
{
public:
- typedef ArenaBlockType::size_type size_type;
+ typedef typename ArenaBlockType::size_type size_type;
/*
* Construct an instance that will allocate blocks of the specified size.
@@ -198,6 +200,14 @@
ArenaBlockListType m_blocks;
const size_type m_blockSize;
+
+private:
+
+ // Not defined...
+ ArenaAllocator(const ArenaAllocator<ObjectType, ArenaBlockType>&);
+
+ ArenaAllocator<ObjectType, ArenaBlockType>&
+ operator=(const ArenaAllocator<ObjectType, ArenaBlockType>&);
};
1.6 +76 -17 xml-xalan/c/src/PlatformSupport/ArenaBlock.hpp
Index: ArenaBlock.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/ArenaBlock.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ArenaBlock.hpp 2000/07/28 21:59:56 1.5
+++ ArenaBlock.hpp 2000/08/22 20:18:48 1.6
@@ -67,6 +67,59 @@
+#if defined(XALAN_NO_STD_ALLOCATORS) && !defined(XALAN_NO_SELECTIVE_TEMPLATE_INSTANTIATION)
+#include <PlatformSupport/XalanAllocator.hpp>
+#endif
+
+
+#define XALAN_NO_SELECTIVE_TEMPLATE_INSTANTIATION
+#if defined(XALAN_NO_SELECTIVE_TEMPLATE_INSTANTIATION)
+
+template <class Type>
+class ArenaBlockAllocator
+{
+public:
+
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef Type* pointer;
+ typedef const Type* const_pointer;
+ typedef Type& reference;
+ typedef const Type& const_reference;
+ typedef Type value_type;
+
+ ArenaBlockAllocator()
+ {
+ }
+
+ ArenaBlockAllocator(const ArenaBlockAllocator<Type>&)
+ {
+ };
+
+ ~ArenaBlockAllocator()
+ {
+ }
+
+ pointer
+ allocate(
+ size_type size,
+ const void* /* hint */ = 0)
+ {
+ return (pointer)operator new(size * sizeof(Type));
+ }
+
+ void
+ deallocate(
+ pointer p,
+ size_type /* n */)
+ {
+ operator delete(p);
+ }
+};
+#endif
+
+
+
template<class ObjectType>
class ArenaBlockDestroy
{
@@ -81,19 +134,23 @@
-template<class ObjectType,
- class DestroyFunctionType = ArenaBlockDestroy<ObjectType>,
-#if defined(XALAN_NO_NAMESPACES)
- class AllocatorType = allocator<ObjectType> >
-#else
- class AllocatorType = std::allocator<ObjectType> >
-#endif
+template<class ObjectType>
class ArenaBlock
{
public:
- typedef AllocatorType::size_type size_type;
+#if defined(XALAN_NO_SELECTIVE_TEMPLATE_INSTANTIATION)
+ typedef ArenaBlockAllocator<ObjectType> AllocatorType;
+#elif defined(XALAN_NO_STD_ALLOCATORS)
+ typedef XalanAllocator<ObjectType> AllocatorType;
+#else
+ typedef std::allocator<ObjectType> AllocatorType;
+#endif
+
+ typedef ArenaBlockDestroy<ObjectType> DestroyFunctionType;
+ typedef AllocatorType::size_type size_type;
+
/*
* Construct an ArenaBlock of the specified size
* of objects.
@@ -101,6 +158,7 @@
* @param theBlockSize The size of the block (the number of objects it can contain).
*/
ArenaBlock(size_type theBlockSize) :
+ m_destroyFunction(DestroyFunctionType()),
m_objectCount(0),
m_blockSize(theBlockSize),
m_objectBlock(0),
@@ -330,8 +388,8 @@
struct DeleteFunctor
{
DeleteFunctor(
- const ArenaBlock& theArenaBlock,
- const DestroyFunctionType& theDestroyFunction) :
+ const ArenaBlock<ObjectType>& theArenaBlock,
+ const DestroyFunctionType& theDestroyFunction) :
m_arenaBlock(theArenaBlock),
m_destroyFunction(theDestroyFunction)
{
@@ -348,8 +406,8 @@
private:
- const ArenaBlock& m_arenaBlock;
- const DestroyFunctionType& m_destroyFunction;
+ const ArenaBlock<ObjectType>& m_arenaBlock;
+ const DestroyFunctionType& m_destroyFunction;
};
friend struct DeleteFunctor;
@@ -358,14 +416,15 @@
private:
- // Cannot and should not be implemented...
- ArenaBlock(const ArenaBlock&);
+ // Not implemented...
+ ArenaBlock(const ArenaBlock<ObjectType>&);
- ArenaBlock&
- operator=(const ArenaBlock&);
+ ArenaBlock<ObjectType>&
+ operator=(const ArenaBlock<ObjectType>&);
bool
- operator==(const ArenaBlock&) const;
+ operator==(const ArenaBlock<ObjectType>&) const;
+
// data members...
size_type m_objectCount;
1.11 +8 -18 xml-xalan/c/src/PlatformSupport/AttributeListImpl.cpp
Index: AttributeListImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/AttributeListImpl.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- AttributeListImpl.cpp 2000/08/07 19:51:08 1.10
+++ AttributeListImpl.cpp 2000/08/22 20:18:49 1.11
@@ -61,11 +61,11 @@
#include <algorithm>
#include <cassert>
-#include <memory>
#include "DOMStringHelper.hpp"
+#include "XalanAutoPtr.hpp"
@@ -133,10 +133,6 @@
AttributeListImpl&
AttributeListImpl::operator=(const AttributeListImpl& theRHS)
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::auto_ptr;
-#endif
-
if (this != &theRHS)
{
// Note that we can't chain up to our base class operator=()
@@ -159,14 +155,14 @@
{
assert(theRHS.m_AttributeVector[i] != 0);
- auto_ptr<AttributeVectorEntry> theEntry(
+ XalanAutoPtr<AttributeVectorEntry> theEntry(
new AttributeVectorEntry(*theRHS.m_AttributeVector[i]));
// Add the item...
tempVector.push_back(theEntry.get());
// The entry is now safely in the vector, so release the
- // auto_ptr...
+ // XalanAutoPtr...
AttributeVectorEntry* const entry = theEntry.release();
// Create an entry in the index map...
@@ -319,7 +315,6 @@
-
const XMLCh*
AttributeListImpl::getValue(const char* const name) const
{
@@ -390,10 +385,6 @@
const XMLCh* type,
const XMLCh* value)
{
-#if !defined(XALAN_NO_NAMESPACES)
- using std::auto_ptr;
-#endif
-
assert(name != 0);
assert(type != 0);
assert(value != 0);
@@ -416,7 +407,7 @@
}
else
{
- auto_ptr<AttributeVectorEntry> theEntry(
+ XalanAutoPtr<AttributeVectorEntry> theEntry(
new AttributeVectorEntry(XMLChVectorType(name, endArray(name) + 1),
XMLChVectorType(value, endArray(value) + 1),
XMLChVectorType(type, endArray(type) + 1)));
@@ -425,7 +416,7 @@
m_AttributeVector.push_back(theEntry.get());
// The entry is now safely in the vector, so release the
- // auto_ptr...
+ // XalanAutoPtr...
AttributeVectorEntry* const entry = theEntry.release();
// Create an entry in the index map.
@@ -443,13 +434,12 @@
bool
-AttributeListImpl::removeAttribute(const XMLCh* const name)
+AttributeListImpl::removeAttribute(const XMLCh* name)
{
assert(name != 0);
assert(m_AttributeKeyMap.size() == m_AttributeVector.size());
#if !defined(XALAN_NO_NAMESPACES)
- using std::auto_ptr;
using std::bind1st;
using std::equal_to;
using std::find_if;
@@ -468,12 +458,12 @@
const AttributeVectorType::iterator j =
find_if(m_AttributeVector.begin(),
m_AttributeVector.end(),
- bind1st(equal_to<const AttributeVectorEntry*>(), (*i).second));
+ bind1st(equal_to<AttributeVectorEntry*>(), (*i).second));
assert(j != m_AttributeVector.end());
// This will delete the entry, even if something
// bad happens updating the containers.
- auto_ptr<const AttributeVectorEntry> theGuard(*j);
+ XalanAutoPtr<AttributeVectorEntry> theGuard(*j);
// Erase it from the vector.
m_AttributeVector.erase(j);
1.9 +2 -2 xml-xalan/c/src/PlatformSupport/AttributeListImpl.hpp
Index: AttributeListImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/AttributeListImpl.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- AttributeListImpl.hpp 2000/08/07 19:51:08 1.8
+++ AttributeListImpl.hpp 2000/08/22 20:18:49 1.9
@@ -187,7 +187,7 @@
#if defined(XALAN_NO_NAMESPACES)
// This vector will hold the entries.
- typedef vector<const AttributeVectorEntry*> AttributeVectorType;
+ typedef vector<AttributeVectorEntry*> AttributeVectorType;
// This map will associate a name with a pointer to the entry that corresponds
// to that name.
@@ -196,7 +196,7 @@
less_null_terminated_arrays<XMLCh> > AttributeKeyMapType;
#else
// This vector will hold the entries.
- typedef std::vector<const AttributeVectorEntry*> AttributeVectorType;
+ typedef std::vector<AttributeVectorEntry*> AttributeVectorType;
// This map will associate a name with a pointer to the entry that corresponds
// to that name.
1.31 +105 -16 xml-xalan/c/src/PlatformSupport/DOMStringHelper.cpp
Index: DOMStringHelper.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/DOMStringHelper.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- DOMStringHelper.cpp 2000/08/15 19:41:10 1.30
+++ DOMStringHelper.cpp 2000/08/22 20:18:50 1.31
@@ -98,6 +98,7 @@
#include "DoubleSupport.hpp"
#include "STLHelper.hpp"
#include "TextOutputStream.hpp"
+#include "XalanAutoPtr.hpp"
@@ -393,7 +394,7 @@
char* const theTranscodedString =
theString.transcode();
- array_auto_ptr<char> theJanitor(theTranscodedString);
+ const XalanArrayAutoPtr<char> theJanitor(theTranscodedString);
theStream << theTranscodedString;
}
@@ -431,7 +432,56 @@
+#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
+template<class OutputIteratorType>
+inline void
+XalanCopy(
+ const char* begin,
+ const char* end,
+ OutputIteratorType iterator)
+{
+ for(; begin != end; ++iterator, ++begin)
+ {
+ *iterator = *begin;
+ }
+}
+
+
+
+template<class OutputIteratorType>
+inline void
+XalanCopy(
+ const XalanDOMChar* begin,
+ const XalanDOMChar* end,
+ OutputIteratorType iterator)
+{
+ for(; begin != end; ++iterator, ++begin)
+ {
+ *iterator = *begin;
+ }
+}
+
+
+
+template<class OutputIteratorType, class UnaryFunction>
+inline void
+XalanTransform(
+ const XalanDOMChar* begin,
+ const XalanDOMChar* end,
+ OutputIteratorType iterator,
+ UnaryFunction function)
+{
+ for(; begin != end; ++iterator, ++begin)
+ {
+ *iterator = function(*begin);
+ }
+}
+
+#endif
+
+
+
XALAN_PLATFORMSUPPORT_EXPORT_FUNCTION(XalanDOMString)
substring(
const XalanDOMString& theString,
@@ -471,9 +521,17 @@
const XalanDOMChar* const ptr = theString.rawBuffer();
- copy(ptr,
- ptr + theLength,
- back_inserter(theBuffer));
+#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
+ XalanCopy(
+ ptr,
+ ptr + theLength,
+ back_inserter(theBuffer));
+#else
+ copy(
+ ptr,
+ ptr + theLength,
+ back_inserter(theBuffer));
+#endif
return XalanDOMString(theBuffer.begin(), theBuffer.size());
}
@@ -505,10 +563,19 @@
const XalanDOMChar* const theBuffer = c_wstr(theInputString);
assert(theBuffer != 0);
- transform(theBuffer,
- theBuffer + theStringLength,
- back_inserter(theConvertedString),
- theFunction);
+#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
+ XalanTransform(
+ theBuffer,
+ theBuffer + theStringLength,
+ back_inserter(theConvertedString),
+ theFunction);
+#else
+ transform(
+ theBuffer,
+ theBuffer + theStringLength,
+ back_inserter(theConvertedString),
+ theFunction);
+#endif
return XalanDOMString(theConvertedString.begin(), theConvertedString.size());
}
@@ -795,7 +862,7 @@
{
XalanDOMChar* theTranscodedData = XMLString::transcode(data);
- array_auto_ptr<XalanDOMChar> theJanitor(theTranscodedData);
+ const XalanArrayAutoPtr<XalanDOMChar> theJanitor(theTranscodedData);
// Create a vector which includes the terminating 0.
@@ -810,9 +877,17 @@
theResult.reserve(theLength);
- copy(data,
- data + theLength,
- back_inserter(theResult));
+#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
+ XalanCopy(
+ data,
+ data + theLength,
+ back_inserter(theResult));
+#else
+ copy(
+ data,
+ data + theLength,
+ back_inserter(theResult));
+#endif
return theResult;
}
@@ -1058,7 +1133,11 @@
const unsigned int theLength = length(theBuffer);
+#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
+ XalanCopy(theBuffer, theBuffer + theLength, theResult);
+#else
copy(theBuffer, theBuffer + theLength, theResult);
+#endif
return XalanDOMString(theResult, theLength);
@@ -1082,7 +1161,11 @@
const unsigned int theLength = length(theBuffer);
+#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
+ XalanCopy(theBuffer, theBuffer + theLength, theResult);
+#else
copy(theBuffer, theBuffer + theLength, theResult);
+#endif
return XalanDOMString(theResult, theLength);
}
@@ -1116,10 +1199,13 @@
const unsigned int theLength = length(theBuffer);
+#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
+ XalanCopy(theBuffer, theBuffer + theLength, theResult);
+#else
copy(theBuffer, theBuffer + theLength, theResult);
+#endif
return XalanDOMString(theResult, theLength);
-
#endif
}
@@ -1177,10 +1263,13 @@
const unsigned int theLength = length(theBuffer);
+#if defined(XALAN_NO_ALGORITHMS_WITH_BUILTINS)
+ XalanCopy(theBuffer, theBuffer + theLength, theResult);
+#else
copy(theBuffer, theBuffer + theLength, theResult);
+#endif
return XalanDOMString(theResult, theLength);
-
#endif
}
@@ -1261,7 +1350,7 @@
//
wchar_t* const tmpSource = new wchar_t[realLen + 1];
- array_auto_ptr<wchar_t> tmpSourceJanitor(tmpSource);
+ const XalanArrayAutoPtr<wchar_t> tmpSourceJanitor(tmpSource);
if (isSameSize)
{
@@ -1283,7 +1372,7 @@
// Allocate out storage member
char* const localForm = new char[targetLen + 1];
- array_auto_ptr<char> localFormJanitor(localForm);
+ const XalanArrayAutoPtr<char> localFormJanitor(localForm);
//
// And transcode our temp source buffer to the local buffer. Cap it
1.8 +24 -12 xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.cpp
Index: NamedNodeMapAttributeList.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- NamedNodeMapAttributeList.cpp 2000/04/11 14:35:30 1.7
+++ NamedNodeMapAttributeList.cpp 2000/08/22 20:18:50 1.8
@@ -72,6 +72,7 @@
m_lastIndex(theMap.getLength() - 1),
m_cachedData()
{
+ m_cachedData.push_back(XALAN_STATIC_UCODE_STRING("CDATA"));
}
@@ -99,28 +100,25 @@
// safe, so we have a vector to hold everything.
const XalanAttr* const theAttribute =
#if defined(XALAN_OLD_STYLE_CASTS)
- (const XalanAttr*)m_nodeMap.item(m_lastIndex - index)
+ (const XalanAttr*)m_nodeMap.item(m_lastIndex - index);
#else
static_cast<const XalanAttr*>(m_nodeMap.item(m_lastIndex - index));
#endif
assert(theAttribute != 0);
- m_cachedData.push_back(theAttribute->getName());
+ cacheData(theAttribute->getName());
return c_wstr(m_cachedData.back());
}
-// This is out here so we don't have to worry about multithreading issues.
-static const XalanDOMCharVectorType theType(MakeXalanDOMCharVector(XALAN_STATIC_UCODE_STRING("CDATA")));
-
-
-
const XMLCh*
NamedNodeMapAttributeList::getType(const unsigned int /* index */) const
{
- return &theType.front();
+ assert(m_cachedData.size() > 0);
+
+ return c_wstr(m_cachedData.front());
}
@@ -130,13 +128,13 @@
{
const XalanAttr* const theAttribute =
#if defined(XALAN_OLD_STYLE_CASTS)
- (const XalanAttr*)m_nodeMap.item(m_lastIndex - index)
+ (const XalanAttr*)m_nodeMap.item(m_lastIndex - index);
#else
static_cast<const XalanAttr*>(m_nodeMap.item(m_lastIndex - index));
#endif
assert(theAttribute != 0);
- m_cachedData.push_back(theAttribute->getValue());
+ cacheData(theAttribute->getValue());
return c_wstr(m_cachedData.back());
}
@@ -146,7 +144,9 @@
const XMLCh*
NamedNodeMapAttributeList::getType(const XMLCh* const /* name */) const
{
- return &theType.front();
+ assert(m_cachedData.size() > 0);
+
+ return c_wstr(m_cachedData.front());
}
@@ -173,7 +173,7 @@
static_cast<const XalanAttr*>(theNode);
#endif
- m_cachedData.push_back(theAttribute->getValue());
+ cacheData(theAttribute->getValue());
return c_wstr(m_cachedData.back());
}
@@ -188,4 +188,16 @@
MakeXalanDOMCharVector(name);
return getValue(theName.front());
+}
+
+
+
+void
+NamedNodeMapAttributeList::cacheData(const XalanDOMString& theData) const
+{
+#if defined(XALAN_NO_MUTABLE)
+ ((NamedNodeMapAttributeList*)this)->m_cachedData.push_back(theData);
+#else
+ m_cachedData.push_back(theData);
+#endif
}
1.4 +3 -0 xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.hpp
Index: NamedNodeMapAttributeList.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NamedNodeMapAttributeList.hpp 2000/04/11 14:35:30 1.3
+++ NamedNodeMapAttributeList.hpp 2000/08/22 20:18:51 1.4
@@ -114,6 +114,9 @@
private:
+ void
+ cacheData(const XalanDOMString& theData) const;
+
// Not implemented...
NamedNodeMapAttributeList&
operator=(const NamedNodeMapAttributeList&);
1.9 +22 -18 xml-xalan/c/src/PlatformSupport/ReusableArenaAllocator.hpp
Index: ReusableArenaAllocator.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/ReusableArenaAllocator.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ReusableArenaAllocator.hpp 2000/07/28 21:59:56 1.8
+++ ReusableArenaAllocator.hpp 2000/08/22 20:18:51 1.9
@@ -70,30 +70,26 @@
-template<class ObjectType,
- class DestroyFunctionType = ArenaBlockDestroy<ObjectType>,
-#if defined(XALAN_NO_NAMESPACES)
- class AllocatorType = allocator<ObjectType>,
-#else
- class AllocatorType = std::allocator<ObjectType>,
-#endif
- class ReusableArenaBlockType = ReusableArenaBlock<ObjectType,
- DestroyFunctionType,
- AllocatorType> >
+template<class ObjectType>
class ReusableArenaAllocator : public ArenaAllocator<ObjectType,
- DestroyFunctionType,
- AllocatorType,
- ReusableArenaBlockType>
+ ReusableArenaBlock<ObjectType> >
{
public:
+ typedef ReusableArenaBlock<ObjectType> ReusableArenaBlockType;
+
typedef ReusableArenaBlockType::size_type size_type;
typedef ArenaAllocator<ObjectType,
- DestroyFunctionType,
- AllocatorType,
ReusableArenaBlockType> BaseClassType;
+ // $$$ ToDo: This typedef is here because of a bug in gcc.
+#if defined (XALAN_NO_NAMESPACES)
+ typedef vector<ReusableArenaBlockType*> ArenaBlockListType;
+#else
+ typedef std::vector<ReusableArenaBlockType*> ArenaBlockListType;
+#endif
+
/*
* Construct an instance that will allocate blocks of the specified size.
*
@@ -130,7 +126,6 @@
}
else
{
- // Search for the block that owns the object...
const ArenaBlockListType::reverse_iterator theEnd = m_blocks.rend();
ArenaBlockListType::reverse_iterator i = m_blocks.rbegin();
@@ -173,9 +168,10 @@
m_lastBlockReferenced->blockAvailable() == false)
{
// Search back for a block with some space available...
- ArenaBlockListType::reverse_iterator i = m_blocks.rbegin();
const ArenaBlockListType::reverse_iterator theEnd = m_blocks.rend();
+ ArenaBlockListType::reverse_iterator i = m_blocks.rbegin();
+
while(i != theEnd)
{
assert(*i != 0);
@@ -237,9 +233,10 @@
if (fResult == false)
{
// Search back for a block with some space available...
- ArenaBlockListType::const_reverse_iterator i = m_blocks.rbegin();
const ArenaBlockListType::const_reverse_iterator theEnd = m_blocks.rend();
+ ArenaBlockListType::const_reverse_iterator i = m_blocks.rbegin();
+
while(i != theEnd)
{
assert(*i != 0);
@@ -263,6 +260,13 @@
private:
+ // Not defined...
+ ReusableArenaAllocator(const ReusableArenaAllocator<ObjectType>&);
+
+ ReusableArenaAllocator<ObjectType>&
+ operator=(const ReusableArenaAllocator<ObjectType>&);
+
+ // Data members...
ReusableArenaBlockType* m_lastBlockReferenced;
};
1.6 +9 -18 xml-xalan/c/src/PlatformSupport/ReusableArenaBlock.hpp
Index: ReusableArenaBlock.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/ReusableArenaBlock.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ReusableArenaBlock.hpp 2000/07/28 21:59:56 1.5
+++ ReusableArenaBlock.hpp 2000/08/22 20:18:51 1.6
@@ -66,22 +66,12 @@
-template<class ObjectType,
- class DestroyFunctionType = ArenaBlockDestroy<ObjectType>,
-#if defined(XALAN_NO_NAMESPACES)
- class AllocatorType = allocator<ObjectType> >
-#else
- class AllocatorType = std::allocator<ObjectType> >
-#endif
-class ReusableArenaBlock : public ArenaBlock<ObjectType,
- DestroyFunctionType,
- AllocatorType>
+template<class ObjectType>
+class ReusableArenaBlock : public ArenaBlock<ObjectType>
{
public:
- typedef ArenaBlock<ObjectType,
- DestroyFunctionType,
- AllocatorType> BaseClassType;
+ typedef ArenaBlock<ObjectType> BaseClassType;
/*
* Construct an ArenaBlock of the specified size
@@ -216,14 +206,15 @@
private:
- // Cannot and should not be implemented...
- ReusableArenaBlock(const ReusableArenaBlock&);
+ // Not implemented...
+ ReusableArenaBlock(const ReusableArenaBlock<ObjectType>&);
- ReusableArenaBlock&
- operator=(const ReusableArenaBlock&);
+ ReusableArenaBlock<ObjectType>&
+ operator=(const ReusableArenaBlock<ObjectType>&);
bool
- operator==(const ReusableArenaBlock&) const;
+ operator==(const ReusableArenaBlock<ObjectType>&) const;
+
/*
* Determine if the block is on the free list. The behavior is
1.11 +0 -57 xml-xalan/c/src/PlatformSupport/STLHelper.hpp
Index: STLHelper.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/STLHelper.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- STLHelper.hpp 2000/08/15 17:19:54 1.10
+++ STLHelper.hpp 2000/08/22 20:18:52 1.11
@@ -95,63 +95,6 @@
-// A class similar to auto_ptr, but for arrays.
-template<class T>
-class array_auto_ptr
-{
-public:
-
- array_auto_ptr(T* thePointer = 0) :
- m_pointer(thePointer)
- {
- }
-
- array_auto_ptr(array_auto_ptr& theSource) :
- m_pointer(theSource.release())
- {
- }
-
- array_auto_ptr&
- operator=(array_auto_ptr& theRHS)
- {
- if (this != &theRHS)
- {
- delete m_pointer;
-
- m_pointer = theRHS.release();
- }
-
- return *this;
- }
-
- ~array_auto_ptr()
- {
- delete [] m_pointer;
- }
-
- T*
- get() const
- {
- return m_pointer;
- }
-
- T*
- release()
- {
- T* const temp = m_pointer;
-
- m_pointer = 0;
-
- return temp;
- }
-
-private:
-
- T* m_pointer;
-};
-
-
-
#if !defined(XALAN_SGI_BASED_STL)
/**
1.7 +1 -1 xml-xalan/c/src/PlatformSupport/URISupport.cpp
Index: URISupport.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/URISupport.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- URISupport.cpp 2000/08/11 21:14:54 1.6
+++ URISupport.cpp 2000/08/22 20:18:52 1.7
@@ -117,7 +117,7 @@
else
{
// Assume it's a file specification...
- array_auto_ptr<XMLCh> theFullPath(XMLPlatformUtils::getFullPath(c_wstr(urlString)));
+ XalanArrayAutoPtr<XMLCh> theFullPath(XMLPlatformUtils::getFullPath(c_wstr(urlString)));
assert(theFullPath.get() != 0);
theNormalizedURI = theFullPath.get();
1.3 +2 -9 xml-xalan/c/src/PlatformSupport/URISupport.hpp
Index: URISupport.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/URISupport.hpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- URISupport.hpp 2000/08/11 20:45:07 1.2
+++ URISupport.hpp 2000/08/22 20:18:53 1.3
@@ -64,10 +64,6 @@
-#include <memory>
-
-
-
#include <util/XMLURL.hpp>
@@ -77,6 +73,7 @@
#include <PlatformSupport/XSLException.hpp>
+#include <PlatformSupport/XalanAutoPtr.hpp>
@@ -84,11 +81,7 @@
{
public:
-#if defined(XALAN_NO_NAMESPACES)
- typedef auto_ptr<XMLURL> URLAutoPtrType;
-#else
- typedef std::auto_ptr<XMLURL> URLAutoPtrType;
-#endif
+ typedef XalanAutoPtr<XMLURL> URLAutoPtrType;
/**
* Determine the fully qualified URI for a string.
1.4 +2 -1 xml-xalan/c/src/PlatformSupport/XalanNumberFormat.cpp
Index: XalanNumberFormat.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/XalanNumberFormat.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XalanNumberFormat.cpp 2000/05/29 22:22:55 1.3
+++ XalanNumberFormat.cpp 2000/08/22 20:18:53 1.4
@@ -60,6 +60,7 @@
#include "DOMStringHelper.hpp"
#include "STLHelper.hpp"
+#include "XalanAutoPtr.hpp"
@@ -130,7 +131,7 @@
XalanDOMChar* const buffer = new XalanDOMChar[bufsize];
- array_auto_ptr<XalanDOMChar> theGuard(buffer);
+ XalanArrayAutoPtr<XalanDOMChar> theGuard(buffer);
XalanDOMChar* p = buffer + bufsize - 1;