You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2003/05/15 21:04:37 UTC

cvs commit: xml-xerces/c/src/xercesc/util BaseRefVectorOf.c BaseRefVectorOf.hpp BinInputStream.hpp BitSet.cpp BitSet.hpp HashBase.hpp HashPtr.cpp HashPtr.hpp HashXMLCh.cpp HashXMLCh.hpp Janitor.c Janitor.hpp KVStringPair.cpp KVStringPair.hpp KeyRefPair.hpp KeyValuePair.hpp LogicalPath.c Mutexes.hpp NameIdPool.c NameIdPool.hpp PanicHandler.hpp PlatformUtils.hpp QName.cpp QName.hpp RefArrayOf.c RefArrayOf.hpp RefArrayVectorOf.c RefHash2KeysTableOf.c RefHash2KeysTableOf.hpp RefHash3KeysIdPool.c RefHash3KeysIdPool.hpp RefHashTableOf.c RefHashTableOf.hpp

knoaman     2003/05/15 12:04:37

  Modified:    c/src/xercesc/util BaseRefVectorOf.c BaseRefVectorOf.hpp
                        BinInputStream.hpp BitSet.cpp BitSet.hpp
                        HashBase.hpp HashPtr.cpp HashPtr.hpp HashXMLCh.cpp
                        HashXMLCh.hpp Janitor.c Janitor.hpp
                        KVStringPair.cpp KVStringPair.hpp KeyRefPair.hpp
                        KeyValuePair.hpp LogicalPath.c Mutexes.hpp
                        NameIdPool.c NameIdPool.hpp PanicHandler.hpp
                        PlatformUtils.hpp QName.cpp QName.hpp RefArrayOf.c
                        RefArrayOf.hpp RefArrayVectorOf.c
                        RefHash2KeysTableOf.c RefHash2KeysTableOf.hpp
                        RefHash3KeysIdPool.c RefHash3KeysIdPool.hpp
                        RefHashTableOf.c RefHashTableOf.hpp
  Log:
  Partial implementation of the configurable memory manager.
  
  Revision  Changes    Path
  1.2       +9 -6      xml-xerces/c/src/xercesc/util/BaseRefVectorOf.c
  
  Index: BaseRefVectorOf.c
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/BaseRefVectorOf.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseRefVectorOf.c	17 Dec 2002 17:17:58 -0000	1.1
  +++ BaseRefVectorOf.c	15 May 2003 19:04:35 -0000	1.2
  @@ -72,10 +72,10 @@
       , fCurCount(0)
       , fMaxCount(maxElems)
       , fElemList(0)
  -    
  +    , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
   {
       // Allocate and initialize the array
  -    fElemList = new TElem*[maxElems];
  +    fElemList = (TElem**) fMemoryManager->allocate(maxElems * sizeof(TElem*));//new TElem*[maxElems];
       for (unsigned int index = 0; index < maxElems; index++)
           fElemList[index] = 0;
   }
  @@ -237,7 +237,7 @@
           for (unsigned int index = 0; index < fCurCount; index++)
               delete fElemList[index];
       }
  -    delete [] fElemList;
  +    fMemoryManager->deallocate(fElemList);//delete [] fElemList;
   }
   
   //
  @@ -251,7 +251,7 @@
       if (fElemList)
           cleanup();
   
  -    fElemList = new TElem*[fMaxCount];
  +    fElemList = (TElem**) fMemoryManager->allocate(fMaxCount * sizeof(TElem*));//new TElem*[fMaxCount];
       for (unsigned int index = 0; index < fMaxCount; index++)
           fElemList[index] = 0;
   
  @@ -304,7 +304,10 @@
           newMax = fMaxCount + 32;
   
       // Allocate the new array and copy over the existing stuff
  -    TElem** newList = new TElem*[newMax];
  +    TElem** newList = (TElem**) fMemoryManager->allocate
  +    (
  +        newMax * sizeof(TElem*)
  +    );//new TElem*[newMax];
       unsigned int index = 0;
       for (; index < fCurCount; index++)
           newList[index] = fElemList[index];
  @@ -314,7 +317,7 @@
           newList[index] = 0;
   
       // Clean up the old array and update our members
  -    delete [] fElemList;
  +    fMemoryManager->deallocate(fElemList);//delete [] fElemList;
       fElemList = newList;
       fMaxCount = newMax;
   }
  
  
  
  1.2       +4 -1      xml-xerces/c/src/xercesc/util/BaseRefVectorOf.hpp
  
  Index: BaseRefVectorOf.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/BaseRefVectorOf.hpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseRefVectorOf.hpp	17 Dec 2002 17:17:58 -0000	1.1
  +++ BaseRefVectorOf.hpp	15 May 2003 19:04:35 -0000	1.2
  @@ -58,6 +58,8 @@
   
   #include <xercesc/util/ArrayIndexOutOfBoundsException.hpp>
   #include <xercesc/util/XMLEnumerator.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
  +#include <xercesc/framework/MemoryManager.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -68,7 +70,7 @@
    * RefArrayVectorOf to implement their own appropriate one.
    *
    */
  -template <class TElem> class BaseRefVectorOf
  +template <class TElem> class BaseRefVectorOf : public XMemory
   {
   public :
       // -----------------------------------------------------------------------
  @@ -116,6 +118,7 @@
       unsigned int    fCurCount;
       unsigned int    fMaxCount;
       TElem**         fElemList;
  +    MemoryManager*  fMemoryManager;
   };
   
   
  
  
  
  1.4       +6 -3      xml-xerces/c/src/xercesc/util/BinInputStream.hpp
  
  Index: BinInputStream.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/BinInputStream.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- BinInputStream.hpp	7 Mar 2003 18:11:54 -0000	1.3
  +++ BinInputStream.hpp	15 May 2003 19:04:35 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.4  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.3  2003/03/07 18:11:54  tng
    * Return a reference instead of void for operator=
    *
  @@ -87,11 +90,11 @@
   #if !defined(BININPUTSTREAM_HPP)
   #define BININPUTSTREAM_HPP
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  -class XMLUTIL_EXPORT BinInputStream
  +class XMLUTIL_EXPORT BinInputStream : public XMemory
   {
   public :
       // -----------------------------------------------------------------------
  
  
  
  1.3       +20 -9     xml-xerces/c/src/xercesc/util/BitSet.cpp
  
  Index: BitSet.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/BitSet.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BitSet.cpp	4 Nov 2002 15:22:03 -0000	1.2
  +++ BitSet.cpp	15 May 2003 19:04:35 -0000	1.3
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.3  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:22:03  tng
    * C++ Namespace Support.
    *
  @@ -85,9 +88,8 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <xercesc/util/IllegalArgumentException.hpp>
  -#include <xercesc/util/ArrayIndexOutOfBoundsException.hpp>
   #include <xercesc/util/BitSet.hpp>
  +#include <xercesc/framework/MemoryManager.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -109,9 +111,11 @@
   // ---------------------------------------------------------------------------
   //  BitSet: Constructors and Destructor
   // ---------------------------------------------------------------------------
  -BitSet::BitSet(const unsigned int size) :
  +BitSet::BitSet( const unsigned int size
  +              , MemoryManager* const manager) :
   
  -    fBits(0)
  +    fMemoryManager(manager)
  +    , fBits(0)
       , fUnitLen(0)
   {
       ensureCapacity(size);
  @@ -119,17 +123,21 @@
   
   BitSet::BitSet(const BitSet& toCopy) :
   
  -    fBits(0)
  +    fMemoryManager(toCopy.fMemoryManager)
  +    , fBits(0)
       , fUnitLen(toCopy.fUnitLen)
   {
  -    fBits = new unsigned long[fUnitLen];
  +    fBits = (unsigned long*) fMemoryManager->allocate
  +    (
  +        fUnitLen * sizeof(unsigned long)
  +    ); //new unsigned long[fUnitLen];
       for (unsigned int i = 0; i < fUnitLen; i++)
           fBits[i] = toCopy.fBits[i];
   }
   
   BitSet::~BitSet()
   {
  -    delete [] fBits;
  +    fMemoryManager->deallocate(fBits); //delete [] fBits;
   }
   
   
  @@ -306,7 +314,10 @@
               unitsNeeded = fUnitLen + kGrowBy;
   
           // Allocate the array, copy the old stuff, and zero the new stuff
  -        unsigned long* newBits = new unsigned long[unitsNeeded];
  +        unsigned long* newBits = (unsigned long*) fMemoryManager->allocate
  +        (
  +            unitsNeeded * sizeof(unsigned long)
  +        ); //new unsigned long[unitsNeeded];
   
           unsigned int index;
           for (index = 0; index < fUnitLen; index++)
  @@ -315,7 +326,7 @@
           for (; index < unitsNeeded; index++)
               newBits[index] = 0;
   
  -        delete [] fBits;
  +        fMemoryManager->deallocate(fBits); //delete [] fBits;
           fBits = newBits;
           fUnitLen = unitsNeeded;
       }
  
  
  
  1.3       +10 -4     xml-xerces/c/src/xercesc/util/BitSet.hpp
  
  Index: BitSet.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/BitSet.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BitSet.hpp	4 Nov 2002 15:22:03 -0000	1.2
  +++ BitSet.hpp	15 May 2003 19:04:35 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.3  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:22:03  tng
    * C++ Namespace Support.
    *
  @@ -84,17 +87,19 @@
   #if !defined(BITSET_HPP)
   #define BITSET_HPP
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  -class XMLUTIL_EXPORT BitSet
  +class XMLUTIL_EXPORT BitSet : public XMemory
   {
   public:
       // -----------------------------------------------------------------------
       //  Constructors and Destructor
       // -----------------------------------------------------------------------
  -    BitSet(const unsigned int size);
  +    BitSet( const unsigned int size
  +          , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
       BitSet(const BitSet& toCopy);
       ~BitSet();
   
  @@ -158,6 +163,7 @@
       //  fUnitLen
       //      The length of the storage array, in storage units not bits.
       // -----------------------------------------------------------------------
  +    MemoryManager*  fMemoryManager;
       unsigned long*  fBits;
       unsigned int    fUnitLen;
   };
  
  
  
  1.3       +3 -3      xml-xerces/c/src/xercesc/util/HashBase.hpp
  
  Index: HashBase.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/HashBase.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HashBase.hpp	4 Nov 2002 15:22:03 -0000	1.2
  +++ HashBase.hpp	15 May 2003 19:04:35 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -57,7 +57,7 @@
   #if !defined(HASHBASE_HPP)
   #define HASHBASE_HPP
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -68,7 +68,7 @@
    * designed to produce hash values for XMLCh* strings.  Any hasher inheriting
    * from <code>HashBase</code> may be specified when the RefHashTableOf hashtable is constructed.
    */
  -class XMLUTIL_EXPORT HashBase
  + class XMLUTIL_EXPORT HashBase : public XMemory
   {
   
   public:
  
  
  
  1.4       +1 -2      xml-xerces/c/src/xercesc/util/HashPtr.cpp
  
  Index: HashPtr.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/HashPtr.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HashPtr.cpp	4 Nov 2002 15:22:03 -0000	1.3
  +++ HashPtr.cpp	15 May 2003 19:04:35 -0000	1.4
  @@ -54,8 +54,7 @@
    * <http://www.apache.org/>.
    */
   
  -#include <xercesc/util/XercesDefs.hpp>
  -#include "HashPtr.hpp"
  +#include <xercesc/util/HashPtr.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  
  
  
  1.4       +0 -1      xml-xerces/c/src/xercesc/util/HashPtr.hpp
  
  Index: HashPtr.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/HashPtr.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HashPtr.hpp	4 Nov 2002 15:22:03 -0000	1.3
  +++ HashPtr.hpp	15 May 2003 19:04:35 -0000	1.4
  @@ -57,7 +57,6 @@
   #if !defined(HASHPTR_HPP)
   #define HASHPTR_HPP
   
  -#include <xercesc/util/XercesDefs.hpp>
   #include <xercesc/util/HashBase.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
  
  
  
  1.4       +1 -1      xml-xerces/c/src/xercesc/util/HashXMLCh.cpp
  
  Index: HashXMLCh.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/HashXMLCh.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- HashXMLCh.cpp	4 Nov 2002 15:22:03 -0000	1.3
  +++ HashXMLCh.cpp	15 May 2003 19:04:35 -0000	1.4
  @@ -54,7 +54,7 @@
    * <http://www.apache.org/>.
    */
   
  -#include "HashXMLCh.hpp"
  +#include <xercesc/util/HashXMLCh.hpp>
   #include <xercesc/util/XMLString.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
  
  
  
  1.3       +0 -1      xml-xerces/c/src/xercesc/util/HashXMLCh.hpp
  
  Index: HashXMLCh.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/HashXMLCh.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HashXMLCh.hpp	4 Nov 2002 15:22:03 -0000	1.2
  +++ HashXMLCh.hpp	15 May 2003 19:04:35 -0000	1.3
  @@ -57,7 +57,6 @@
   #if !defined(HASHXMLCH_HPP)
   #define HASHXMLCH_HPP
   
  -#include <xercesc/util/XercesDefs.hpp>
   #include <xercesc/util/HashBase.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
  
  
  
  1.3       +36 -1     xml-xerces/c/src/xercesc/util/Janitor.c
  
  Index: Janitor.c
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Janitor.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Janitor.c	4 Nov 2002 15:22:04 -0000	1.2
  +++ Janitor.c	15 May 2003 19:04:35 -0000	1.3
  @@ -56,6 +56,9 @@
   
   /**
    * $Log$
  + * Revision 1.3  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -165,6 +168,15 @@
   // -----------------------------------------------------------------------
   template <class T> ArrayJanitor<T>::ArrayJanitor(T* const toDelete) :
       fData(toDelete)
  +    , fMemoryManager(0)
  +{
  +}
  +
  +template <class T>
  +ArrayJanitor<T>::ArrayJanitor(T* const toDelete,
  +                              MemoryManager* const manager) :
  +    fData(toDelete)
  +    , fMemoryManager(manager)
   {
   }
   
  @@ -213,8 +225,31 @@
   template <class T> void
   ArrayJanitor<T>::reset(T* p)
   {
  -	delete [] fData;
  +	if (fData) {
  +
  +		if (fMemoryManager)
  +            fMemoryManager->deallocate(fData);
  +        else
  +            delete [] fData;
  +    }
  +
  +	fData = p;
  +    fMemoryManager = 0;
  +}
  +
  +template <class T> void
  +ArrayJanitor<T>::reset(T* p, MemoryManager* manager)
  +{
  +	if (fData) {
  +
  +		if (fMemoryManager)
  +            fMemoryManager->deallocate(fData);
  +        else
  +            delete [] fData;
  +    }
  +
   	fData = p;
  +    fMemoryManager = manager;
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.3       +10 -3     xml-xerces/c/src/xercesc/util/Janitor.hpp
  
  Index: Janitor.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Janitor.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Janitor.hpp	4 Nov 2002 15:22:04 -0000	1.2
  +++ Janitor.hpp	15 May 2003 19:04:35 -0000	1.3
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.3  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -95,11 +98,12 @@
   #if !defined(JANITOR_HPP)
   #define JANITOR_HPP
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
  +#include <xercesc/framework/MemoryManager.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  -template <class T> class Janitor
  +template <class T> class Janitor : public XMemory
   {
   public  :
       // -----------------------------------------------------------------------
  @@ -139,13 +143,14 @@
   
   
   
  -template <class T> class ArrayJanitor
  +template <class T> class ArrayJanitor : public XMemory
   {
   public  :
       // -----------------------------------------------------------------------
       //  Constructors and Destructor
       // -----------------------------------------------------------------------
       ArrayJanitor(T* const toDelete);
  +    ArrayJanitor(T* const toDelete, MemoryManager* const manager);
       ~ArrayJanitor();
   
   
  @@ -159,6 +164,7 @@
   	T*	get() const;
   	T*	release();
   	void reset(T* p = 0);
  +	void reset(T* p, MemoryManager* const manager);
   
   private :
       // -----------------------------------------------------------------------
  @@ -175,6 +181,7 @@
       //      destroyed when this object is destroyed.
       // -----------------------------------------------------------------------
       T*  fData;
  +    MemoryManager* fMemoryManager;
   };
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.3       +21 -39    xml-xerces/c/src/xercesc/util/KVStringPair.cpp
  
  Index: KVStringPair.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/KVStringPair.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- KVStringPair.cpp	4 Nov 2002 15:22:04 -0000	1.2
  +++ KVStringPair.cpp	15 May 2003 19:04:35 -0000	1.3
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.3  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -124,7 +127,8 @@
   // ---------------------------------------------------------------------------
   KVStringPair::KVStringPair() :
   
  -    fKey(0)
  +    fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fKey(0)
       , fKeyAllocSize(0)
       , fValue(0)
       , fValueAllocSize(0)
  @@ -133,7 +137,8 @@
   
   KVStringPair::KVStringPair(const XMLCh* const key, const XMLCh* const value) :
   
  -    fKey(0)
  +    fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fKey(0)
       , fKeyAllocSize(0)
       , fValue(0)
       , fValueAllocSize(0)
  @@ -143,7 +148,8 @@
   
   KVStringPair::KVStringPair(const KVStringPair& toCopy) :
   
  -    fKey(0)
  +    fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fKey(0)
       , fKeyAllocSize(0)
       , fValue(0)
       , fValueAllocSize(0)
  @@ -153,32 +159,8 @@
   
   KVStringPair::~KVStringPair()
   {
  -    delete [] fKey;
  -    delete [] fValue;
  -}
  -
  -
  -// ---------------------------------------------------------------------------
  -//  KVStringPair: Getters
  -// ---------------------------------------------------------------------------
  -const XMLCh* KVStringPair::getKey() const
  -{
  -    return fKey;
  -}
  -
  -XMLCh* KVStringPair::getKey()
  -{
  -    return fKey;
  -}
  -
  -const XMLCh* KVStringPair::getValue() const
  -{
  -    return fValue;
  -}
  -
  -XMLCh* KVStringPair::getValue()
  -{
  -    return fValue;
  +    fMemoryManager->deallocate(fKey); //delete [] fKey;
  +    fMemoryManager->deallocate(fValue); //delete [] fValue;
   }
   
   
  @@ -187,28 +169,28 @@
   // ---------------------------------------------------------------------------
   void KVStringPair::setKey(const XMLCh* const newKey)
   {
  -   const unsigned int  len = XMLString::stringLen(newKey);
  +    const unsigned int  len = XMLString::stringLen(newKey);
   
       if (len >= fKeyAllocSize)
  -   {
  -    delete [] fKey;
  +    {
  +        fMemoryManager->deallocate(fKey); //delete [] fKey;
           fKeyAllocSize = len + 1;
  -        fKey = new XMLCh[fKeyAllocSize];
  -   }
  +        fKey = (XMLCh*) fMemoryManager->allocate(fKeyAllocSize * sizeof(XMLCh)); //new XMLCh[fKeyAllocSize];
  +    }
   
       XMLString::copyString(fKey, newKey);
   }
   
   void KVStringPair::setValue(const XMLCh* const newValue)
   {
  -   const unsigned int  len = XMLString::stringLen(newValue);
  +    const unsigned int  len = XMLString::stringLen(newValue);
   
       if (len >= fValueAllocSize)
  -   {
  -    delete [] fValue;
  +    {
  +        fMemoryManager->deallocate(fValue); //delete [] fValue;
           fValueAllocSize = len + 1;
  -        fValue = new XMLCh[fValueAllocSize];
  -   }
  +        fValue = (XMLCh*) fMemoryManager->allocate(fValueAllocSize * sizeof(XMLCh)); //new XMLCh[fValueAllocSize];
  +    }
   
       XMLString::copyString(fValue, newValue);
   }
  
  
  
  1.3       +33 -5     xml-xerces/c/src/xercesc/util/KVStringPair.hpp
  
  Index: KVStringPair.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/KVStringPair.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- KVStringPair.hpp	4 Nov 2002 15:22:04 -0000	1.2
  +++ KVStringPair.hpp	15 May 2003 19:04:35 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.3  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -116,7 +119,8 @@
   #if !defined(KVSTRINGPAIR_HPP)
   #define KVSTRINGPAIR_HPP
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -125,7 +129,7 @@
   //  a pair of strings which represent a 'key=value' type mapping. It works
   //  only in terms of XMLCh type raw strings.
   //
  -class XMLUTIL_EXPORT KVStringPair
  +class XMLUTIL_EXPORT KVStringPair : public XMemory
   {
   public:
       // -----------------------------------------------------------------------
  @@ -177,11 +181,35 @@
       //      The amount of memory allocated for fValue.
       //
       // -----------------------------------------------------------------------
  -    XMLCh*  fKey;
  +    MemoryManager* fMemoryManager;
  +    XMLCh*         fKey;
       unsigned long  fKeyAllocSize;
  -    XMLCh*  fValue;
  +    XMLCh*         fValue;
       unsigned long  fValueAllocSize;
   };
  +
  +// ---------------------------------------------------------------------------
  +//  KVStringPair: Getters
  +// ---------------------------------------------------------------------------
  +inline const XMLCh* KVStringPair::getKey() const
  +{
  +    return fKey;
  +}
  +
  +inline XMLCh* KVStringPair::getKey()
  +{
  +    return fKey;
  +}
  +
  +inline const XMLCh* KVStringPair::getValue() const
  +{
  +    return fValue;
  +}
  +
  +inline XMLCh* KVStringPair::getValue()
  +{
  +    return fValue;
  +}
   
   XERCES_CPP_NAMESPACE_END
   
  
  
  
  1.3       +4 -4      xml-xerces/c/src/xercesc/util/KeyRefPair.hpp
  
  Index: KeyRefPair.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/KeyRefPair.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- KeyRefPair.hpp	4 Nov 2002 15:22:04 -0000	1.2
  +++ KeyRefPair.hpp	15 May 2003 19:04:35 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2002 The Apache Software Foundation.  All rights
  + * Copyright (c) 2002-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -62,11 +62,11 @@
   #define KEYREFPAIR_HPP
   
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  -template <class TKey, class TValue> class KeyRefPair
  +template <class TKey, class TValue> class KeyRefPair : public XMemory
   {
       public  :
           // -------------------------------------------------------------------
  
  
  
  1.3       +6 -3      xml-xerces/c/src/xercesc/util/KeyValuePair.hpp
  
  Index: KeyValuePair.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/KeyValuePair.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- KeyValuePair.hpp	4 Nov 2002 15:22:04 -0000	1.2
  +++ KeyValuePair.hpp	15 May 2003 19:04:35 -0000	1.3
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.3  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -85,11 +88,11 @@
   #define KEYVALUEPAIR_HPP
   
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  -template <class TKey, class TValue> class KeyValuePair
  +template <class TKey, class TValue> class KeyValuePair : public XMemory
   {
       public  :
           // -------------------------------------------------------------------
  
  
  
  1.2       +18 -9     xml-xerces/c/src/xercesc/util/LogicalPath.c
  
  Index: LogicalPath.c
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/LogicalPath.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LogicalPath.c	24 Apr 2003 02:48:00 -0000	1.1
  +++ LogicalPath.c	15 May 2003 19:04:35 -0000	1.2
  @@ -42,8 +42,11 @@
   
   {
       // Create a buffer as large as both parts and empty it
  -    XMLCh* tmpBuf = new XMLCh[XMLString::stringLen(basePath) + 
  -                              XMLString::stringLen(relativePath) + 2];
  +    XMLCh* tmpBuf = (XMLCh*) fgMemoryManager->allocate
  +    (
  +        (XMLString::stringLen(basePath)
  +         + XMLString::stringLen(relativePath) + 2) * sizeof(XMLCh)
  +    );//new XMLCh[XMLString::stringLen(basePath) + XMLString::stringLen(relativePath) + 2];
       *tmpBuf = 0;
   
       //
  @@ -101,9 +104,9 @@
       if ((!path) || (!*path))
           return;
   
  -    XMLCh* srcPtr = XMLString::replicate(path);
  +    XMLCh* srcPtr = XMLString::replicate(path, fgMemoryManager);
       int    srcLen = XMLString::stringLen(srcPtr);
  -    ArrayJanitor<XMLCh>   janName(srcPtr);   
  +    ArrayJanitor<XMLCh>   janName(srcPtr, fgMemoryManager);   
       XMLCh* tarPtr = path;
   
       while (*srcPtr)
  @@ -151,11 +154,17 @@
   void XMLPlatformUtils::removeDotDotSlash(XMLCh* const path)
   {
       int pathLen = XMLString::stringLen(path);
  -    XMLCh* tmp1 = new XMLCh [pathLen+1];
  -    ArrayJanitor<XMLCh>   tmp1Name(tmp1);
  -
  -    XMLCh* tmp2 = new XMLCh [pathLen+1];
  -    ArrayJanitor<XMLCh>   tmp2Name(tmp2);
  +    XMLCh* tmp1 = (XMLCh*) fgMemoryManager->allocate
  +    (
  +        (pathLen+1) * sizeof(XMLCh)
  +    );//new XMLCh [pathLen+1];
  +    ArrayJanitor<XMLCh>   tmp1Name(tmp1, fgMemoryManager);
  +
  +    XMLCh* tmp2 = (XMLCh*) fgMemoryManager->allocate
  +    (
  +        (pathLen+1) * sizeof(XMLCh)
  +    );//new XMLCh [pathLen+1];
  +    ArrayJanitor<XMLCh>   tmp2Name(tmp2, fgMemoryManager);
   
       // remove all "<segment>/../" where "<segment>" is a complete
       // path segment not equal to ".."
  
  
  
  1.4       +7 -4      xml-xerces/c/src/xercesc/util/Mutexes.hpp
  
  Index: Mutexes.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/Mutexes.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Mutexes.hpp	7 Mar 2003 18:11:54 -0000	1.3
  +++ Mutexes.hpp	15 May 2003 19:04:35 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.4  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.3  2003/03/07 18:11:54  tng
    * Return a reference instead of void for operator=
    *
  @@ -88,11 +91,11 @@
   #if !defined(MUTEXES_HPP)
   #define MUTEXES_HPP
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  -class XMLUTIL_EXPORT XMLMutex
  +class XMLUTIL_EXPORT XMLMutex : public XMemory
   {
   public :
       // -----------------------------------------------------------------------
  @@ -137,7 +140,7 @@
   };
   
   
  -class XMLUTIL_EXPORT XMLMutexLock
  +class XMLUTIL_EXPORT XMLMutexLock : public XMemory
   {
       // -----------------------------------------------------------------------
       //  Constructors and Destructor
  
  
  
  1.5       +23 -10    xml-xerces/c/src/xercesc/util/NameIdPool.c
  
  Index: NameIdPool.c
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/NameIdPool.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NameIdPool.c	4 Nov 2002 15:22:04 -0000	1.4
  +++ NameIdPool.c	15 May 2003 19:04:35 -0000	1.5
  @@ -56,6 +56,9 @@
   
   /**
    * $Log$
  + * Revision 1.5  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.4  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -119,9 +122,10 @@
   //  NameIdPool: Constructors and Destructor
   // ---------------------------------------------------------------------------
   template <class TElem>
  -NameIdPool<TElem>::NameIdPool(  const   unsigned int    hashModulus
  -                                , const unsigned int    initSize) :
  -    fBucketList(0)
  +NameIdPool<TElem>::NameIdPool( const unsigned int hashModulus
  +                             , const unsigned int initSize) :
  +    fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fBucketList(0)
       , fIdPtrs(0)
       , fIdPtrsCount(initSize)
       , fIdCounter(0)
  @@ -131,7 +135,10 @@
           ThrowXML(IllegalArgumentException, XMLExcepts::Pool_ZeroModulus);
   
       // Allocate the bucket list and zero them
  -    fBucketList = new NameIdPoolBucketElem<TElem>*[fHashModulus];
  +    fBucketList = (NameIdPoolBucketElem<TElem>**) fMemoryManager->allocate
  +    (
  +        fHashModulus * sizeof(NameIdPoolBucketElem<TElem>*)
  +    ); //new NameIdPoolBucketElem<TElem>*[fHashModulus];
       for (unsigned int index = 0; index < fHashModulus; index++)
           fBucketList[index] = 0;
   
  @@ -142,7 +149,10 @@
       //
       if (!fIdPtrsCount)
           fIdPtrsCount = 256;
  -    fIdPtrs = new TElem*[fIdPtrsCount];
  +    fIdPtrs = (TElem**) fMemoryManager->allocate
  +    (
  +        fIdPtrsCount * sizeof(TElem*)
  +    ); //new TElem*[fIdPtrsCount];
       fIdPtrs[0] = 0;
   }
   
  @@ -152,11 +162,11 @@
       //  Delete the id pointers list. The stuff it points to will be cleaned
       //  up when we clean the bucket lists.
       //
  -    delete [] fIdPtrs;
  +    fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs;
   
       // Remove all elements then delete the bucket list
       removeAll();
  -    delete [] fBucketList;
  +    fMemoryManager->deallocate(fBucketList); //delete [] fBucketList;
   }
   
   
  @@ -263,7 +273,7 @@
       }
   
       // Create a new bucket element and add it to the appropriate list
  -    NameIdPoolBucketElem<TElem>* newBucket = new NameIdPoolBucketElem<TElem>
  +    NameIdPoolBucketElem<TElem>* newBucket = new (fMemoryManager) NameIdPoolBucketElem<TElem>
       (
           elemToAdopt
           , fBucketList[hashVal]
  @@ -278,13 +288,16 @@
       {
           // Create a new count 1.5 times larger and allocate a new array
           unsigned int newCount = (unsigned int)(fIdPtrsCount * 1.5);
  -        TElem** newArray = new TElem*[newCount];
  +        TElem** newArray = (TElem**) fMemoryManager->allocate
  +        (
  +            newCount * sizeof(TElem*)
  +        ); //new TElem*[newCount];
   
           // Copy over the old contents to the new array
           memcpy(newArray, fIdPtrs, fIdPtrsCount * sizeof(TElem*));
   
           // Ok, toss the old array and store the new data
  -        delete [] fIdPtrs;
  +        fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs;
           fIdPtrs = newArray;
           fIdPtrsCount = newCount;
       }
  
  
  
  1.5       +8 -4      xml-xerces/c/src/xercesc/util/NameIdPool.hpp
  
  Index: NameIdPool.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/NameIdPool.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NameIdPool.hpp	7 Mar 2003 18:11:54 -0000	1.4
  +++ NameIdPool.hpp	15 May 2003 19:04:35 -0000	1.5
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.5  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.4  2003/03/07 18:11:54  tng
    * Return a reference instead of void for operator=
    *
  @@ -97,9 +100,9 @@
   #if !defined(NAMEIDPOOL_HPP)
   #define NAMEIDPOOL_HPP
   
  +#include <xercesc/util/XMemory.hpp>
   #include <xercesc/util/XMLString.hpp>
  -#include <string.h>
  -
  +#include <xercesc/util/PlatformUtils.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -136,7 +139,7 @@
   //  lists for each bucket. Because some of the compilers we have to support
   //  are totally brain dead, it cannot be a nested class as it should be.
   //
  -template <class TElem> struct NameIdPoolBucketElem
  +template <class TElem> struct NameIdPoolBucketElem : public XMemory
   {
   public :
       NameIdPoolBucketElem
  @@ -151,7 +154,7 @@
   };
   
   
  -template <class TElem> class NameIdPool
  +template <class TElem> class NameIdPool : public XMemory
   {
   public :
       // -----------------------------------------------------------------------
  @@ -246,6 +249,7 @@
       //      This is the modulus to use in this pool. The fBucketList array
       //      is of this size. It should be a prime number.
       // -----------------------------------------------------------------------
  +    MemoryManager*                  fMemoryManager;
       NameIdPoolBucketElem<TElem>**   fBucketList;
       TElem**                         fIdPtrs;
       unsigned int                    fIdPtrsCount;
  
  
  
  1.3       +6 -3      xml-xerces/c/src/xercesc/util/PanicHandler.hpp
  
  Index: PanicHandler.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/PanicHandler.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PanicHandler.hpp	10 Mar 2003 16:05:11 -0000	1.2
  +++ PanicHandler.hpp	15 May 2003 19:04:35 -0000	1.3
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.3  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2003/03/10 16:05:11  peiyongz
    * assignment operator
    *
  @@ -69,7 +72,7 @@
   #ifndef PANICHANDLER_HPP
   #define PANICHANDLER_HPP
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/XMemory.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -88,7 +91,7 @@
     *
     */
   
  -class XMLUTIL_EXPORT PanicHandler
  +class XMLUTIL_EXPORT PanicHandler : public XMemory
   {
   public:
   
  
  
  
  1.14      +21 -6     xml-xerces/c/src/xercesc/util/PlatformUtils.hpp
  
  Index: PlatformUtils.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/PlatformUtils.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- PlatformUtils.hpp	30 Apr 2003 16:54:37 -0000	1.13
  +++ PlatformUtils.hpp	15 May 2003 19:04:35 -0000	1.14
  @@ -392,10 +392,18 @@
         * @param srcPath The path of the file for which you want the full path
         *
         * @return Returns the fully qualified path of the file name including
  -      * the file name. This is dyanmically allocated and must be deleted
  -      * by the caller when its no longer needed!
  +      *         the file name. This is dyanmically allocated and must be
  +      *         deleted  by the caller when its no longer needed! The memory
  +      *         returned will beallocated using the static memory manager, if
  +      *         user do not supply a memory manager. Users then need to make
  +      *         sure to use either the default or user specific memory manager
  +      *         to deallocate the memory.
         */
  -    static XMLCh* getFullPath(const XMLCh* const srcPath);
  +    static XMLCh* getFullPath
  +    (
  +        const XMLCh* const srcPath
  +        , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
  +    );
   
       /** Gets the current working directory 
         *
  @@ -404,9 +412,16 @@
         *
         * @return Returns the current working directory. 
         *         This is dyanmically allocated and must be deleted
  -      *         by the caller when its no longer needed!
  +      *         by the caller when its no longer needed! The memory returned
  +      *         will be allocated using the static memory manager, if users
  +      *         do not supply a memory manager. Users then need to make sure
  +      *         to use either the default or user specific memory manager to
  +      *         deallocate the memory.
         */
  -    static XMLCh* getCurrentDirectory();
  +    static XMLCh* getCurrentDirectory
  +    (
  +        MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
  +    );
   
       /** Check if a charater is a slash
         *
  
  
  
  1.7       +67 -33    xml-xerces/c/src/xercesc/util/QName.cpp
  
  Index: QName.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/QName.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- QName.cpp	4 Nov 2002 15:22:04 -0000	1.6
  +++ QName.cpp	15 May 2003 19:04:35 -0000	1.7
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.7  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.6  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -104,7 +107,6 @@
    */
   
   #include <xercesc/util/QName.hpp>
  -#include <xercesc/util/Janitor.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -112,7 +114,9 @@
   //  QName: Constructors and Destructor
   // ---------------------------------------------------------------------------
   QName::QName() :
  -      fPrefix(0)
  +
  +    fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fPrefix(0)
       , fPrefixBufSz(0)
       , fLocalPart(0)
       , fLocalPartBufSz(0)
  @@ -122,11 +126,12 @@
   {
   }
   
  -QName::QName(const XMLCh* const        prefix
  -           , const XMLCh* const        localPart
  -           , const unsigned int        uriId
  -            ) :
  -      fPrefix(0)
  +QName::QName( const XMLCh* const prefix
  +            , const XMLCh* const localPart
  +            , const unsigned int uriId) :
  +
  +    fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fPrefix(0)
       , fPrefixBufSz(0)
       , fLocalPart(0)
       , fLocalPartBufSz(0)
  @@ -142,17 +147,17 @@
           //
           setName(prefix, localPart, uriId);
       }
  -
       catch(...)
       {
           cleanUp();
       }
   }
   
  -QName::QName(const XMLCh* const        rawName
  -           , const unsigned int        uriId
  -            ) :
  -      fPrefix(0)
  +QName::QName( const XMLCh* const rawName
  +            , const unsigned int uriId) :
  +
  +    fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fPrefix(0)
       , fPrefixBufSz(0)
       , fLocalPart(0)
       , fLocalPartBufSz(0)
  @@ -168,7 +173,6 @@
           //
           setName(rawName, uriId);
       }
  -
       catch(...)
       {
           cleanUp();
  @@ -184,7 +188,9 @@
   //  QName: Copy Constructors
   // ---------------------------------------------------------------------------
   QName::QName(const QName& qname) :
  -      fPrefix(0)
  +
  +    fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fPrefix(0)
       , fPrefixBufSz(0)
       , fLocalPart(0)
       , fLocalPartBufSz(0)
  @@ -196,12 +202,18 @@
   
       newLen = XMLString::stringLen(qname.getLocalPart());
       fLocalPartBufSz = newLen + 8;
  -    fLocalPart = new XMLCh[fLocalPartBufSz + 1];
  +    fLocalPart = (XMLCh*) fMemoryManager->allocate
  +    (
  +        (fLocalPartBufSz + 1) * sizeof(XMLCh)
  +    ); //new XMLCh[fLocalPartBufSz + 1];
       XMLString::moveChars(fLocalPart, qname.getLocalPart(), newLen + 1);
   
       newLen = XMLString::stringLen(qname.getPrefix());
       fPrefixBufSz = newLen + 8;
  -    fPrefix = new XMLCh[fPrefixBufSz + 1];
  +    fPrefix = (XMLCh*) fMemoryManager->allocate
  +    (
  +        (fPrefixBufSz + 1) * sizeof(XMLCh)
  +    ); //new XMLCh[fPrefixBufSz + 1];
       XMLString::moveChars(fPrefix, qname.getPrefix(), newLen + 1);
   
       fURIId = qname.getURI();
  @@ -238,11 +250,14 @@
               //
               if (!fRawName || (neededLen > fRawNameBufSz))
               {
  -                delete [] fRawName;
  +                fMemoryManager->deallocate(fRawName); //delete [] fRawName;
   
                   // We have to cast off the const'ness to do this
                   ((QName*)this)->fRawNameBufSz = neededLen;
  -                ((QName*)this)->fRawName = new XMLCh[neededLen + 1];
  +                ((QName*)this)->fRawName = (XMLCh*) fMemoryManager->allocate
  +                (
  +                    (neededLen + 1) * sizeof(XMLCh)
  +                ); //new XMLCh[neededLen + 1];
   
                   // Make sure its initially empty
                   *fRawName = 0;
  @@ -290,11 +305,14 @@
               //
               if (!fRawName || (neededLen > fRawNameBufSz))
               {
  -                delete [] fRawName;
  +                fMemoryManager->deallocate(fRawName); //delete [] fRawName;
   
                   // We have to cast off the const'ness to do this
                   ((QName*)this)->fRawNameBufSz = neededLen;
  -                ((QName*)this)->fRawName = new XMLCh[neededLen + 1];
  +                ((QName*)this)->fRawName = (XMLCh*) fMemoryManager->allocate
  +                (
  +                    (neededLen + 1) * sizeof(XMLCh)
  +                ); //new XMLCh[neededLen + 1];
   
                   // Make sure its initially empty
                   *fRawName = 0;
  @@ -342,9 +360,12 @@
       newLen = XMLString::stringLen(rawName);
       if (!fRawNameBufSz || (newLen > fRawNameBufSz))
       {
  -        delete [] fRawName;
  +        fMemoryManager->deallocate(fRawName); //delete [] fRawName;
           fRawNameBufSz = newLen + 8;
  -        fRawName = new XMLCh[fRawNameBufSz + 1];
  +        fRawName = (XMLCh*) fMemoryManager->allocate
  +        (
  +            (fRawNameBufSz + 1) * sizeof(XMLCh)
  +        ); //new XMLCh[fRawNameBufSz + 1];
       }
       XMLString::moveChars(fRawName, rawName, newLen + 1);
   
  @@ -374,9 +395,12 @@
       newLen = XMLString::stringLen(prefix);
       if (!fPrefixBufSz || (newLen > fPrefixBufSz))
       {
  -        delete [] fPrefix;
  +        fMemoryManager->deallocate(fPrefix); //delete [] fPrefix;
           fPrefixBufSz = newLen + 8;
  -        fPrefix = new XMLCh[fPrefixBufSz + 1];
  +        fPrefix = (XMLCh*) fMemoryManager->allocate
  +        (
  +            (fPrefixBufSz + 1) * sizeof(XMLCh)
  +        ); //new XMLCh[fPrefixBufSz + 1];
       }
       XMLString::moveChars(fPrefix, prefix, newLen + 1);
   }
  @@ -385,9 +409,12 @@
   {
       if (!fPrefixBufSz || (newLen > fPrefixBufSz))
       {
  -        delete [] fPrefix;
  +        fMemoryManager->deallocate(fPrefix); //delete [] fPrefix;
           fPrefixBufSz = newLen + 8;
  -        fPrefix = new XMLCh[fPrefixBufSz + 1];
  +        fPrefix = (XMLCh*) fMemoryManager->allocate
  +        (
  +            (fPrefixBufSz + 1) * sizeof(XMLCh)
  +        ); //new XMLCh[fPrefixBufSz + 1];
       }
       XMLString::moveChars(fPrefix, prefix, newLen);
       fPrefix[newLen] = chNull;
  @@ -400,9 +427,12 @@
       newLen = XMLString::stringLen(localPart);
       if (!fLocalPartBufSz || (newLen > fLocalPartBufSz))
       {
  -        delete [] fLocalPart;
  +        fMemoryManager->deallocate(fLocalPart); //delete [] fLocalPart;
           fLocalPartBufSz = newLen + 8;
  -        fLocalPart = new XMLCh[fLocalPartBufSz + 1];
  +        fLocalPart = (XMLCh*) fMemoryManager->allocate
  +        (
  +            (fLocalPartBufSz + 1) * sizeof(XMLCh)
  +        ); //new XMLCh[fLocalPartBufSz + 1];
       }
       XMLString::moveChars(fLocalPart, localPart, newLen + 1);
   }
  @@ -411,9 +441,12 @@
   {
       if (!fLocalPartBufSz || (newLen > fLocalPartBufSz))
       {
  -        delete [] fLocalPart;
  +        fMemoryManager->deallocate(fLocalPart); //delete [] fLocalPart;
           fLocalPartBufSz = newLen + 8;
  -        fLocalPart = new XMLCh[fLocalPartBufSz + 1];
  +        fLocalPart = (XMLCh*) fMemoryManager->allocate
  +        (
  +            (fLocalPartBufSz + 1) * sizeof(XMLCh)
  +        ); //new XMLCh[fLocalPartBufSz + 1];
       }
       XMLString::moveChars(fLocalPart, localPart, newLen);
       fLocalPart[newLen] = chNull;
  @@ -443,9 +476,10 @@
   // ---------------------------------------------------------------------------
   void QName::cleanUp()
   {
  -    delete [] fLocalPart;
  -    delete [] fPrefix;
  -    delete [] fRawName;
  +    fMemoryManager->deallocate(fLocalPart); //delete [] fLocalPart;
  +    fMemoryManager->deallocate(fPrefix); //delete [] fPrefix;
  +    fMemoryManager->deallocate(fRawName); //delete [] fRawName;
  +    fLocalPart = fPrefix = fRawName = 0;
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.6       +7 -3      xml-xerces/c/src/xercesc/util/QName.hpp
  
  Index: QName.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/QName.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- QName.hpp	4 Nov 2002 15:22:04 -0000	1.5
  +++ QName.hpp	15 May 2003 19:04:35 -0000	1.6
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.6  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.5  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -105,11 +108,12 @@
   
   #include <xercesc/util/XMLString.hpp>
   #include <xercesc/util/XMLUniDefs.hpp>
  -#include <xercesc/util/XMLUni.hpp>
  +#include <xercesc/util/XMemory.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  -class XMLUTIL_EXPORT QName
  +class XMLUTIL_EXPORT QName : public XMemory
   {
   public :
       // -----------------------------------------------------------------------
  @@ -214,6 +218,7 @@
       //  fURIId
       //      The id of the URI that this attribute belongs to.
       // -----------------------------------------------------------------------
  +    MemoryManager*      fMemoryManager;
       XMLCh*              fPrefix;
       unsigned int        fPrefixBufSz;
       XMLCh*              fLocalPart;
  @@ -221,7 +226,6 @@
       XMLCh*              fRawName;
       unsigned int        fRawNameBufSz;
       unsigned int        fURIId;
  -
   };
   
   // ---------------------------------------------------------------------------
  
  
  
  1.3       +17 -8     xml-xerces/c/src/xercesc/util/RefArrayOf.c
  
  Index: RefArrayOf.c
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefArrayOf.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RefArrayOf.c	4 Nov 2002 15:22:04 -0000	1.2
  +++ RefArrayOf.c	15 May 2003 19:04:35 -0000	1.3
  @@ -56,6 +56,9 @@
   
   /**
    * $Log$
  + * Revision 1.3  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -95,8 +98,9 @@
   
       fSize(size)
       , fArray(0)
  +    , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
   {
  -    fArray = new TElem*[fSize];
  +    fArray = (TElem**) fMemoryManager->allocate(fSize * sizeof(TElem*));//new TElem*[fSize];
       for (unsigned int index = 0; index < fSize; index++)
           fArray[index] = 0;
   }
  @@ -106,8 +110,9 @@
   
       fSize(size)
       , fArray(0)
  +    , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
   {
  -    fArray = new TElem*[fSize];
  +    fArray = (TElem**) fMemoryManager->allocate(fSize * sizeof(TElem*));//new TElem*[fSize];
       for (unsigned int index = 0; index < fSize; index++)
           fArray[index] = values[index];
   }
  @@ -117,15 +122,16 @@
   
       fSize(source.fSize)
       , fArray(0)
  +    , fMemoryManager(XMLPlatformUtils::fgMemoryManager)
   {
  -    fArray = new TElem*[fSize];
  +    fArray = (TElem**) fMemoryManager->allocate(fSize * sizeof(TElem*));//new TElem*[fSize];
       for (unsigned int index = 0; index < fSize; index++)
           fArray[index] = source.fArray[index];
   }
   
   template <class TElem> RefArrayOf<TElem>::~RefArrayOf()
   {
  -    delete [] fArray;
  +    fMemoryManager->deallocate(fArray);//delete [] fArray;
   }
   
   
  @@ -157,9 +163,9 @@
       // Reallocate if not the same size
       if (toAssign.fSize != fSize)
       {
  -        delete [] fArray;
  +        fMemoryManager->deallocate(fArray);//delete [] fArray;
           fSize = toAssign.fSize;
  -        fArray = new TElem*[fSize];
  +        fArray = (TElem**) fMemoryManager->allocate(fSize * sizeof(TElem*));//new TElem*[fSize];
       }
   
       // Copy over the source elements
  @@ -257,7 +263,10 @@
           ThrowXML(IllegalArgumentException, XMLExcepts::Array_BadNewSize);
   
       // Allocate the new array
  -    TElem** newArray = new TElem*[newSize];
  +    TElem** newArray = (TElem**) fMemoryManager->allocate
  +    (
  +        newSize * sizeof(TElem*)
  +    );//new TElem*[newSize];
   
       // Copy the existing values
       unsigned int index = 0;
  @@ -268,7 +277,7 @@
           newArray[index] = 0;
   
       // Delete the old array and udpate our members
  -    delete [] fArray;
  +    fMemoryManager->deallocate(fArray);//delete [] fArray;
       fArray = newArray;
       fSize = newSize;
   }
  
  
  
  1.4       +7 -3      xml-xerces/c/src/xercesc/util/RefArrayOf.hpp
  
  Index: RefArrayOf.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefArrayOf.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RefArrayOf.hpp	4 Nov 2002 15:22:04 -0000	1.3
  +++ RefArrayOf.hpp	15 May 2003 19:04:35 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.4  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.3  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -88,14 +91,14 @@
   #if !defined(REFARRAY_HPP)
   #define REFARRAY_HPP
   
  -#include <xercesc/util/XercesDefs.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   #include <xercesc/util/ArrayIndexOutOfBoundsException.hpp>
   #include <xercesc/util/IllegalArgumentException.hpp>
   #include <xercesc/util/XMLEnumerator.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  -template <class TElem> class RefArrayOf
  +template <class TElem> class RefArrayOf : public XMemory
   {
   public :
       // -----------------------------------------------------------------------
  @@ -144,6 +147,7 @@
       // -----------------------------------------------------------------------
   	unsigned int    fSize;
   	TElem**         fArray;
  +    MemoryManager*  fMemoryManager;
   };
   
   
  
  
  
  1.3       +1 -1      xml-xerces/c/src/xercesc/util/RefArrayVectorOf.c
  
  Index: RefArrayVectorOf.c
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefArrayVectorOf.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RefArrayVectorOf.c	17 Dec 2002 21:06:02 -0000	1.2
  +++ RefArrayVectorOf.c	15 May 2003 19:04:35 -0000	1.3
  @@ -23,7 +23,7 @@
         for (unsigned int index = 0; index < fCurCount; index++)
           delete[] fElemList[index];
       }
  -    delete [] fElemList;
  +    fMemoryManager->deallocate(fElemList);//delete [] fElemList;
   }
   
   
  
  
  
  1.3       +37 -12    xml-xerces/c/src/xercesc/util/RefHash2KeysTableOf.c
  
  Index: RefHash2KeysTableOf.c
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefHash2KeysTableOf.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RefHash2KeysTableOf.c	4 Nov 2002 15:22:04 -0000	1.2
  +++ RefHash2KeysTableOf.c	15 May 2003 19:04:35 -0000	1.3
  @@ -56,6 +56,9 @@
   
   /**
    * $Log$
  + * Revision 1.3  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -94,39 +97,61 @@
   // ---------------------------------------------------------------------------
   //  RefHash2KeysTableOf: Constructors and Destructor
   // ---------------------------------------------------------------------------
  -template <class TVal> RefHash2KeysTableOf<TVal>::RefHash2KeysTableOf(const unsigned int modulus, const bool adoptElems)
  -	: fAdoptedElems(adoptElems), fBucketList(0), fHashModulus(modulus)
  +template <class TVal>
  +RefHash2KeysTableOf<TVal>::RefHash2KeysTableOf( const unsigned int modulus
  +                                              , const bool         adoptElems)
  +    : fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +	, fAdoptedElems(adoptElems)
  +    , fBucketList(0)
  +    , fHashModulus(modulus)
  +    , fHash(0)
   {
       initialize(modulus);
   	
   	// create default hasher
  -	fHash = new HashXMLCh();
  +	fHash = new (fMemoryManager) HashXMLCh();
   }
   
  -template <class TVal> RefHash2KeysTableOf<TVal>::RefHash2KeysTableOf(const unsigned int modulus, const bool adoptElems, HashBase* hashBase)
  -	: fAdoptedElems(adoptElems), fBucketList(0), fHashModulus(modulus)
  +template <class TVal>
  +RefHash2KeysTableOf<TVal>::RefHash2KeysTableOf( const unsigned int modulus
  +                                              , const bool         adoptElems
  +                                              , HashBase*          hashBase)
  +	: fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fAdoptedElems(adoptElems)
  +    , fBucketList(0)
  +    , fHashModulus(modulus)
  +    , fHash(0)
   {
   	initialize(modulus);
   	// set hasher
   	fHash = hashBase;
   }
   
  -template <class TVal> RefHash2KeysTableOf<TVal>::RefHash2KeysTableOf(const unsigned int modulus)
  -	: fAdoptedElems(true), fBucketList(0), fHashModulus(modulus)
  +template <class TVal>
  +RefHash2KeysTableOf<TVal>::RefHash2KeysTableOf(const unsigned int modulus)
  +	: fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fAdoptedElems(true)
  +    , fBucketList(0)
  +    , fHashModulus(modulus)
  +    , fHash(0)
   {
   	initialize(modulus);
   
   	// create default hasher
  -	fHash = new HashXMLCh();
  +	fHash = new (fMemoryManager) HashXMLCh();
   }
   
  -template <class TVal> void RefHash2KeysTableOf<TVal>::initialize(const unsigned int modulus)
  +template <class TVal>
  +void RefHash2KeysTableOf<TVal>::initialize(const unsigned int modulus)
   {
   	if (modulus == 0)
           ThrowXML(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus);
   
       // Allocate the bucket list and zero them
  -    fBucketList = new RefHash2KeysTableBucketElem<TVal>*[fHashModulus];
  +    fBucketList = (RefHash2KeysTableBucketElem<TVal>**) fMemoryManager->allocate
  +    (
  +        fHashModulus * sizeof(RefHash2KeysTableBucketElem<TVal>*)
  +    ); //new RefHash2KeysTableBucketElem<TVal>*[fHashModulus];
       for (unsigned int index = 0; index < fHashModulus; index++)
           fBucketList[index] = 0;
   }
  @@ -136,7 +161,7 @@
       removeAll();
   
       // Then delete the bucket list & hasher
  -    delete [] fBucketList;
  +    fMemoryManager->deallocate(fBucketList); //delete [] fBucketList;
   	delete fHash;
   }
   
  @@ -247,7 +272,7 @@
       }
        else
       {
  -        newBucket = new RefHash2KeysTableBucketElem<TVal>(key1, key2, valueToAdopt, fBucketList[hashVal]);
  +        newBucket = new (fMemoryManager) RefHash2KeysTableBucketElem<TVal>(key1, key2, valueToAdopt, fBucketList[hashVal]);
           fBucketList[hashVal] = newBucket;
       }
   }
  
  
  
  1.4       +9 -8      xml-xerces/c/src/xercesc/util/RefHash2KeysTableOf.hpp
  
  Index: RefHash2KeysTableOf.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefHash2KeysTableOf.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RefHash2KeysTableOf.hpp	4 Nov 2002 15:22:04 -0000	1.3
  +++ RefHash2KeysTableOf.hpp	15 May 2003 19:04:35 -0000	1.4
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.4  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.3  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -89,16 +92,13 @@
   #define REFHASH2KEYSTABLEOF_HPP
   
   
  -#include <xercesc/util/XercesDefs.hpp>
   #include <xercesc/util/HashBase.hpp>
   #include <xercesc/util/IllegalArgumentException.hpp>
   #include <xercesc/util/NoSuchElementException.hpp>
   #include <xercesc/util/RuntimeException.hpp>
  -#include <xercesc/util/XMLExceptMsgs.hpp>
  -#include <xercesc/util/XMLEnumerator.hpp>
   #include <xercesc/util/XMLString.hpp>
  -#include <xercesc/util/HashBase.hpp>
   #include <xercesc/util/HashXMLCh.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -116,7 +116,7 @@
   //  This should really be a nested class, but some of the compilers we
   //  have to support cannot deal with that!
   //
  -template <class TVal> struct RefHash2KeysTableBucketElem
  +template <class TVal> struct RefHash2KeysTableBucketElem : public XMemory
   {
       RefHash2KeysTableBucketElem(void* key1, int key2, TVal* const value, RefHash2KeysTableBucketElem<TVal>* next)
   		: fData(value), fNext(next), fKey1(key1), fKey2(key2)
  @@ -130,7 +130,7 @@
   };
   
   
  -template <class TVal> class RefHash2KeysTableOf
  +template <class TVal> class RefHash2KeysTableOf : public XMemory
   {
   public:
       // -----------------------------------------------------------------------
  @@ -205,8 +205,9 @@
   	//  fHash
   	//      The hasher for the key1 data type.
       // -----------------------------------------------------------------------
  +    MemoryManager*                      fMemoryManager;
       bool                                fAdoptedElems;
  -    RefHash2KeysTableBucketElem<TVal>**      fBucketList;
  +    RefHash2KeysTableBucketElem<TVal>** fBucketList;
       unsigned int                        fHashModulus;
   	HashBase*							fHash;
   };
  
  
  
  1.3       +41 -25    xml-xerces/c/src/xercesc/util/RefHash3KeysIdPool.c
  
  Index: RefHash3KeysIdPool.c
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefHash3KeysIdPool.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RefHash3KeysIdPool.c	4 Nov 2002 15:22:04 -0000	1.2
  +++ RefHash3KeysIdPool.c	15 May 2003 19:04:35 -0000	1.3
  @@ -56,6 +56,9 @@
   
   /**
    * $Log$
  + * Revision 1.3  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.2  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -91,13 +94,15 @@
   // ---------------------------------------------------------------------------
   //  RefHash3KeysIdPool: Constructors and Destructor
   // ---------------------------------------------------------------------------
  -template <class TVal> RefHash3KeysIdPool<TVal>::RefHash3KeysIdPool(
  -              const unsigned int modulus
  -            , const bool adoptElems
  -            , const unsigned int    initSize) :
  -	 fAdoptedElems(adoptElems)
  +template <class TVal>
  +RefHash3KeysIdPool<TVal>::RefHash3KeysIdPool( const unsigned int modulus
  +                                            , const bool         adoptElems
  +                                            , const unsigned int initSize) :
  +    fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fAdoptedElems(adoptElems)
       , fBucketList(0)
       , fHashModulus(modulus)
  +    , fHash(0)
       , fIdPtrs(0)
       , fIdPtrsCount(initSize)
       , fIdCounter(0)
  @@ -105,7 +110,7 @@
       initialize(modulus);
   
       // create default hasher
  -    fHash = new HashXMLCh();
  +    fHash = new (fMemoryManager) HashXMLCh();
   
       //
       //  Allocate the initial id pointers array. We don't have to zero them
  @@ -114,18 +119,20 @@
       //
       if (!fIdPtrsCount)
           fIdPtrsCount = 256;
  -    fIdPtrs = new TVal*[fIdPtrsCount];
  +    fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*)); //new TVal*[fIdPtrsCount];
       fIdPtrs[0] = 0;
   }
   
  -template <class TVal> RefHash3KeysIdPool<TVal>::RefHash3KeysIdPool(
  -              const unsigned int modulus
  -            , const bool adoptElems
  -            , HashBase* hashBase
  -            , const unsigned int    initSize) :
  -	 fAdoptedElems(adoptElems)
  +template <class TVal>
  +RefHash3KeysIdPool<TVal>::RefHash3KeysIdPool( const unsigned int modulus
  +                                            , const bool         adoptElems
  +                                            , HashBase*          hashBase
  +                                            , const unsigned int initSize) :
  +	fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fAdoptedElems(adoptElems)
       , fBucketList(0)
       , fHashModulus(modulus)
  +    , fHash(0)
       , fIdPtrs(0)
       , fIdPtrsCount(initSize)
       , fIdCounter(0)
  @@ -141,15 +148,18 @@
       //
       if (!fIdPtrsCount)
           fIdPtrsCount = 256;
  -    fIdPtrs = new TVal*[fIdPtrsCount];
  +    fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*)); //new TVal*[fIdPtrsCount];
       fIdPtrs[0] = 0;
   }
   
  -template <class TVal> RefHash3KeysIdPool<TVal>::RefHash3KeysIdPool(const unsigned int modulus
  -            , const unsigned int    initSize) :
  -	 fAdoptedElems(true)
  +template <class TVal>
  +RefHash3KeysIdPool<TVal>::RefHash3KeysIdPool( const unsigned int modulus
  +                                            , const unsigned int initSize) :
  +	fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fAdoptedElems(true)
       , fBucketList(0)
       , fHashModulus(modulus)
  +    , fHash(0)
       , fIdPtrs(0)
       , fIdPtrsCount(initSize)
       , fIdCounter(0)
  @@ -158,7 +168,7 @@
   
       // create default hasher
   
  -    fHash = new HashXMLCh();
  +    fHash = new (fMemoryManager) HashXMLCh();
   
       //
       //  Allocate the initial id pointers array. We don't have to zero them
  @@ -167,7 +177,7 @@
       //
       if (!fIdPtrsCount)
           fIdPtrsCount = 256;
  -    fIdPtrs = new TVal*[fIdPtrsCount];
  +    fIdPtrs = (TVal**) fMemoryManager->allocate(fIdPtrsCount * sizeof(TVal*)); //new TVal*[fIdPtrsCount];
       fIdPtrs[0] = 0;
   }
   
  @@ -177,7 +187,10 @@
           ThrowXML(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus);
   
       // Allocate the bucket list and zero them
  -    fBucketList = new RefHash3KeysTableBucketElem<TVal>*[fHashModulus];
  +    fBucketList = (RefHash3KeysTableBucketElem<TVal>**) fMemoryManager->allocate
  +    (
  +        fHashModulus * sizeof(RefHash3KeysTableBucketElem<TVal>*)
  +    ); //new RefHash3KeysTableBucketElem<TVal>*[fHashModulus];
       for (unsigned int index = 0; index < fHashModulus; index++)
           fBucketList[index] = 0;
   }
  @@ -187,8 +200,8 @@
       removeAll();
   
       // Then delete the bucket list & hasher & id pointers list
  -    delete [] fIdPtrs;
  -    delete [] fBucketList;
  +    fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs;
  +    fMemoryManager->deallocate(fBucketList); //delete [] fBucketList;
       delete fHash;
   }
   
  @@ -317,7 +330,7 @@
       }
        else
       {
  -        newBucket = new RefHash3KeysTableBucketElem<TVal>(key1, key2, key3, valueToAdopt, fBucketList[hashVal]);
  +        newBucket = new (fMemoryManager) RefHash3KeysTableBucketElem<TVal>(key1, key2, key3, valueToAdopt, fBucketList[hashVal]);
           fBucketList[hashVal] = newBucket;
       }
   
  @@ -329,13 +342,16 @@
       {
           // Create a new count 1.5 times larger and allocate a new array
           unsigned int newCount = (unsigned int)(fIdPtrsCount * 1.5);
  -        TVal** newArray = new TVal*[newCount];
  +        TVal** newArray = (TVal**) fMemoryManager->allocate
  +        (
  +            newCount * sizeof(TVal*)
  +        ); //new TVal*[newCount];
   
           // Copy over the old contents to the new array
           memcpy(newArray, fIdPtrs, fIdPtrsCount * sizeof(TVal*));
   
           // Ok, toss the old array and store the new data
  -        delete [] fIdPtrs;
  +        fMemoryManager->deallocate(fIdPtrs); //delete [] fIdPtrs;
           fIdPtrs = newArray;
           fIdPtrsCount = newCount;
       }
  
  
  
  1.4       +11 -10    xml-xerces/c/src/xercesc/util/RefHash3KeysIdPool.hpp
  
  Index: RefHash3KeysIdPool.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefHash3KeysIdPool.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RefHash3KeysIdPool.hpp	4 Nov 2002 15:22:04 -0000	1.3
  +++ RefHash3KeysIdPool.hpp	15 May 2003 19:04:35 -0000	1.4
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.4  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.3  2002/11/04 15:22:04  tng
    * C++ Namespace Support.
    *
  @@ -89,15 +92,12 @@
   #define REFHASH3KEYSIDPOOL_HPP
   
   
  -#include <xercesc/util/XercesDefs.hpp>
   #include <xercesc/util/HashBase.hpp>
   #include <xercesc/util/IllegalArgumentException.hpp>
   #include <xercesc/util/NoSuchElementException.hpp>
   #include <xercesc/util/RuntimeException.hpp>
  -#include <xercesc/util/XMLExceptMsgs.hpp>
  -#include <xercesc/util/XMLEnumerator.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
   #include <xercesc/util/XMLString.hpp>
  -#include <xercesc/util/HashBase.hpp>
   #include <xercesc/util/HashXMLCh.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
  @@ -117,7 +117,7 @@
   //  This should really be a nested class, but some of the compilers we
   //  have to support cannot deal with that!
   //
  -template <class TVal> struct RefHash3KeysTableBucketElem
  +template <class TVal> struct RefHash3KeysTableBucketElem : public XMemory
   {
       RefHash3KeysTableBucketElem(
                 void* key1
  @@ -141,7 +141,7 @@
   };
   
   
  -template <class TVal> class RefHash3KeysIdPool
  +template <class TVal> class RefHash3KeysIdPool : public XMemory
   {
   public:
       // -----------------------------------------------------------------------
  @@ -246,13 +246,14 @@
       //      element. So the first element is 1, the next is 2, etc... This
       //      means that this value is set to the top index of the fIdPtrs array.
       // -----------------------------------------------------------------------
  +    MemoryManager*                      fMemoryManager;
       bool                                fAdoptedElems;
       RefHash3KeysTableBucketElem<TVal>** fBucketList;
       unsigned int                        fHashModulus;
  -    HashBase*                       fHash;
  -    TVal**                          fIdPtrs;
  -    unsigned int                    fIdPtrsCount;
  -    unsigned int                    fIdCounter;
  +    HashBase*                           fHash;
  +    TVal**                              fIdPtrs;
  +    unsigned int                        fIdPtrsCount;
  +    unsigned int                        fIdCounter;
   };
   
   
  
  
  
  1.8       +57 -22    xml-xerces/c/src/xercesc/util/RefHashTableOf.c
  
  Index: RefHashTableOf.c
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefHashTableOf.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RefHashTableOf.c	15 May 2003 10:37:08 -0000	1.7
  +++ RefHashTableOf.c	15 May 2003 19:04:35 -0000	1.8
  @@ -56,6 +56,9 @@
   
   /**
    * $Log$
  + * Revision 1.8  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.7  2003/05/15 10:37:08  gareth
    * Optimization. We now resize the hash when appropriate. Patch by Nathan Codding.
    *
  @@ -132,30 +135,57 @@
   // ---------------------------------------------------------------------------
   //  RefHashTableOf: Constructors and Destructor
   // ---------------------------------------------------------------------------
  -template <class TVal> RefHashTableOf<TVal>::RefHashTableOf(const unsigned int modulus, const bool adoptElems)
  -	: fAdoptedElems(adoptElems), fBucketList(0), fHashModulus(modulus), fInitialModulus(modulus), fCount(0)
  +template <class TVal>
  +RefHashTableOf<TVal>::RefHashTableOf( const unsigned int modulus
  +                                    , const bool adoptElems)
  +
  +    : fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fAdoptedElems(adoptElems)
  +    , fBucketList(0)
  +    , fHashModulus(modulus)
  +    , fHash(0)
  +    , fInitialModulus(modulus)
  +    , fCount(0)
   {
       initialize(modulus);
   	
   	// create default hasher
  -	fHash = new HashXMLCh();
  +	fHash = new (fMemoryManager) HashXMLCh();
   }
   
  -template <class TVal> RefHashTableOf<TVal>::RefHashTableOf(const unsigned int modulus, const bool adoptElems, HashBase* hashBase)
  -	: fAdoptedElems(adoptElems), fBucketList(0), fHashModulus(modulus), fInitialModulus(modulus), fCount(0)
  +template <class TVal>
  +RefHashTableOf<TVal>::RefHashTableOf( const unsigned int modulus
  +                                    , const bool adoptElems
  +                                    , HashBase* hashBase)
  +
  +    : fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fAdoptedElems(adoptElems)
  +    , fBucketList(0)
  +    , fHashModulus(modulus)
  +    , fHash(0)
  +    , fInitialModulus(modulus)
  +    , fCount(0)
   {
       initialize(modulus);
       // set hasher
       fHash = hashBase;
   }
   
  -template <class TVal> RefHashTableOf<TVal>::RefHashTableOf(const unsigned int modulus)
  -	: fAdoptedElems(true), fBucketList(0), fHashModulus(modulus), fInitialModulus(modulus), fCount(0)
  +template <class TVal>
  +RefHashTableOf<TVal>::RefHashTableOf(const unsigned int modulus)
  +
  +    : fMemoryManager(XMLPlatformUtils::fgMemoryManager)
  +    , fAdoptedElems(true)
  +    , fBucketList(0)
  +    , fHashModulus(modulus)
  +    , fHash(0)
  +    , fInitialModulus(modulus)
  +    , fCount(0)
   {
       initialize(modulus);
   
       // create default hasher
  -    fHash = new HashXMLCh();
  +    fHash = new (fMemoryManager) HashXMLCh();
   }
   
   template <class TVal> void RefHashTableOf<TVal>::initialize(const unsigned int modulus)
  @@ -164,7 +194,10 @@
           ThrowXML(IllegalArgumentException, XMLExcepts::HshTbl_ZeroModulus);
   
       // Allocate the bucket list and zero them
  -    fBucketList = new RefHashTableBucketElem<TVal>*[fHashModulus];
  +    fBucketList = (RefHashTableBucketElem<TVal>**) fMemoryManager->allocate
  +    (
  +        fHashModulus * sizeof(RefHashTableBucketElem<TVal>*)
  +    ); //new RefHashTableBucketElem<TVal>*[fHashModulus];
       for (unsigned int index = 0; index < fHashModulus; index++)
           fBucketList[index] = 0;
   }
  @@ -174,7 +207,7 @@
       removeAll();
   
       // Then delete the bucket list & hasher
  -    delete [] fBucketList;
  +    fMemoryManager->deallocate(fBucketList); //delete [] fBucketList;
       delete fHash;
   }
   
  @@ -236,7 +269,7 @@
           // Clean out this entry
           fBucketList[buckInd] = 0;
       }
  -    
  +
       fCount = 0;
   }
   
  @@ -304,7 +337,8 @@
       removeAll();
   
       // Then delete the bucket list & hasher
  -    delete [] fBucketList;
  +    fMemoryManager->deallocate(fBucketList); //delete [] fBucketList;
  +    fBucketList = 0;
       delete fHash;
   }
   
  @@ -324,7 +358,7 @@
       if (hashBase)
           fHash = hashBase;
       else
  -        fHash = new HashXMLCh();   // create default hasher
  +        fHash = new (fMemoryManager) HashXMLCh();   // create default hasher
   }
   
   
  @@ -380,14 +414,13 @@
   // ---------------------------------------------------------------------------
   template <class TVal> void RefHashTableOf<TVal>::put(void* key, TVal* const valueToAdopt)
   {
  -    
       // Apply 0.75 load factor to find threshold.
       unsigned int threshold = fHashModulus * 3 / 4;
       
       // If we've grown too big, expand the table and rehash.
       if (fCount >= threshold)
           rehash();
  -    
  +
       // First see if the key exists already
       unsigned int hashVal;
       RefHashTableBucketElem<TVal>* newBucket = findBucketElem(key, hashVal);
  @@ -405,10 +438,10 @@
       }
        else
       {
  -        newBucket = new RefHashTableBucketElem<TVal>(key, valueToAdopt, fBucketList[hashVal]);
  +        newBucket = new (fMemoryManager) RefHashTableBucketElem<TVal>(key, valueToAdopt, fBucketList[hashVal]);
           fBucketList[hashVal] = newBucket;
       }
  -    
  +
       fCount++;
   }
   
  @@ -417,8 +450,7 @@
   // ---------------------------------------------------------------------------
   //  RefHashTableOf: Private methods
   // ---------------------------------------------------------------------------
  -template <class TVal> void RefHashTableOf<TVal>::
  -rehash()
  +template <class TVal> void RefHashTableOf<TVal>::rehash()
   {
       unsigned int index;
       unsigned int oldMod = fHashModulus;
  @@ -426,7 +458,10 @@
       
       RefHashTableBucketElem<TVal>** oldBucketList = fBucketList;
       
  -    fBucketList = new RefHashTableBucketElem<TVal>*[fHashModulus];
  +    fBucketList = (RefHashTableBucketElem<TVal>**) fMemoryManager->allocate
  +    (
  +        fHashModulus * sizeof(RefHashTableBucketElem<TVal>*)
  +    );//new RefHashTableBucketElem<TVal>*[fHashModulus];
       for (index = 0; index < fHashModulus; index++)
           fBucketList[index] = 0;
       
  @@ -456,7 +491,7 @@
           }
       }
               
  -    delete[] oldBucketList;
  +    fMemoryManager->deallocate(oldBucketList);//delete[] oldBucketList;
       
   }
   
  @@ -539,7 +574,7 @@
               delete curElem;
   
               fCount--;
  -            
  +
               return;
           }
   
  
  
  
  1.8       +15 -13    xml-xerces/c/src/xercesc/util/RefHashTableOf.hpp
  
  Index: RefHashTableOf.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/RefHashTableOf.hpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RefHashTableOf.hpp	15 May 2003 10:37:08 -0000	1.7
  +++ RefHashTableOf.hpp	15 May 2003 19:04:35 -0000	1.8
  @@ -1,7 +1,7 @@
   /*
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -56,6 +56,9 @@
   
   /*
    * $Log$
  + * Revision 1.8  2003/05/15 19:04:35  knoaman
  + * Partial implementation of the configurable memory manager.
  + *
    * Revision 1.7  2003/05/15 10:37:08  gareth
    * Optimization. We now resize the hash when appropriate. Patch by Nathan Codding.
    *
  @@ -123,16 +126,14 @@
   #define REFHASHTABLEOF_HPP
   
   
  -#include <xercesc/util/XercesDefs.hpp>
   #include <xercesc/util/HashBase.hpp>
   #include <xercesc/util/IllegalArgumentException.hpp>
   #include <xercesc/util/NoSuchElementException.hpp>
   #include <xercesc/util/RuntimeException.hpp>
  -#include <xercesc/util/XMLExceptMsgs.hpp>
  -#include <xercesc/util/XMLEnumerator.hpp>
   #include <xercesc/util/XMLString.hpp>
  -#include <xercesc/util/HashBase.hpp>
   #include <xercesc/util/HashXMLCh.hpp>
  +#include <xercesc/util/PlatformUtils.hpp>
  +#include <xercesc/framework/MemoryManager.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -148,7 +149,7 @@
   //  This should really be a nested class, but some of the compilers we
   //  have to support cannot deal with that!
   //
  -template <class TVal> struct RefHashTableBucketElem
  +template <class TVal> struct RefHashTableBucketElem : public XMemory
   {
       RefHashTableBucketElem(void* key, TVal* const value, RefHashTableBucketElem<TVal>* next)
   		: fData(value), fNext(next), fKey(key)
  @@ -161,7 +162,7 @@
   };
   
   
  -template <class TVal> class RefHashTableOf
  +template <class TVal> class RefHashTableOf : public XMemory
   {
   public:
       // -----------------------------------------------------------------------
  @@ -245,12 +246,13 @@
   	//  fHash
   	//      The hasher for the key data type.
       // -----------------------------------------------------------------------
  -    bool                                fAdoptedElems;
  -    RefHashTableBucketElem<TVal>**      fBucketList;
  -    unsigned int                        fHashModulus;
  -    unsigned int                        fInitialModulus;
  -    unsigned int                        fCount;
  -	HashBase*							fHash;
  +    MemoryManager*                 fMemoryManager;
  +    bool                           fAdoptedElems;
  +    RefHashTableBucketElem<TVal>** fBucketList;
  +    unsigned int                   fHashModulus;
  +    unsigned int                   fInitialModulus;
  +    unsigned int                   fCount;
  +    HashBase*                      fHash;
   };
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org