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/04/21 22:46:02 UTC

cvs commit: xml-xerces/c/src/xercesc/framework XMLAttDef.cpp XMLAttDef.hpp XMLEntityDecl.cpp XMLEntityDecl.hpp XMLNotationDecl.cpp XMLNotationDecl.hpp XMLRefInfo.hpp

knoaman     2003/04/21 13:46:02

  Modified:    c/src/xercesc/framework XMLAttDef.cpp XMLAttDef.hpp
                        XMLEntityDecl.cpp XMLEntityDecl.hpp
                        XMLNotationDecl.cpp XMLNotationDecl.hpp
                        XMLRefInfo.hpp
  Log:
  Use XMLString::release to prepare for configurable memory manager.
  
  Revision  Changes    Path
  1.3       +16 -16    xml-xerces/c/src/xercesc/framework/XMLAttDef.cpp
  
  Index: XMLAttDef.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLAttDef.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLAttDef.cpp	4 Nov 2002 15:00:21 -0000	1.2
  +++ XMLAttDef.cpp	21 Apr 2003 20:46:01 -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
  @@ -62,10 +62,9 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  +#include <xercesc/framework/XMLAttDef.hpp>
   #include <xercesc/util/ArrayIndexOutOfBoundsException.hpp>
  -#include <xercesc/util/XMLUniDefs.hpp>
   #include <xercesc/util/XMLUni.hpp>
  -#include <xercesc/framework/XMLAttDef.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -156,13 +155,13 @@
                       , const XMLAttDef::DefAttTypes  defType) :
   
       fDefaultType(defType)
  -    , fEnumeration(0)
  -    , fId(XMLAttDef::fgInvalidAttrId)
  -    , fProvided(false)
       , fType(type)
  -    , fValue(0)
       , fCreateReason(XMLAttDef::NoReason)
  +    , fProvided(false)
       , fExternalAttribute(false)
  +    , fId(XMLAttDef::fgInvalidAttrId)
  +    , fValue(0)
  +    , fEnumeration(0)
   {
   }
   
  @@ -172,20 +171,18 @@
                       , const XMLCh* const            enumValues) :
   
       fDefaultType(defType)
  -    , fEnumeration(0)
  -    , fId(XMLAttDef::fgInvalidAttrId)
  -    , fProvided(false)
       , fType(type)
  -    , fValue(0)
       , fCreateReason(XMLAttDef::NoReason)
  +    , fProvided(false)
       , fExternalAttribute(false)
  +    , fId(XMLAttDef::fgInvalidAttrId)
  +    , fValue(XMLString::replicate(attrValue))
  +    , fEnumeration(0)
   {
       try
       {
  -        fValue = XMLString::replicate(attrValue);
           fEnumeration = XMLString::replicate(enumValues);
       }
  -
       catch(...)
       {
           cleanUp();
  @@ -198,8 +195,11 @@
   // ---------------------------------------------------------------------------
   void XMLAttDef::cleanUp()
   {
  -    delete [] fEnumeration;
  -    delete [] fValue;
  +    if (fEnumeration)
  +       XMLString::release(&fEnumeration);
  +
  +    if (fValue)
  +        XMLString::release(&fValue);
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.7       +14 -14    xml-xerces/c/src/xercesc/framework/XMLAttDef.hpp
  
  Index: XMLAttDef.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLAttDef.hpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XMLAttDef.hpp	7 Mar 2003 18:08:10 -0000	1.6
  +++ XMLAttDef.hpp	21 Apr 2003 20:46:01 -0000	1.7
  @@ -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.7  2003/04/21 20:46:01  knoaman
  + * Use XMLString::release to prepare for configurable memory manager.
  + *
    * Revision 1.6  2003/03/07 18:08:10  tng
    * Return a reference instead of void for operator=
    *
  @@ -557,17 +560,16 @@
       //      This flag indicates whether or not the attribute was declared externally.
       // -----------------------------------------------------------------------
       DefAttTypes     fDefaultType;
  -    XMLCh*          fEnumeration;
  -    unsigned int    fId;
  -    bool            fProvided;
       AttTypes        fType;
  -    XMLCh*          fValue;
       CreateReasons   fCreateReason;
  +    bool            fProvided;
       bool            fExternalAttribute;
  +    unsigned int    fId;
  +    XMLCh*          fValue;
  +    XMLCh*          fEnumeration;
   };
   
   
  -
   // ---------------------------------------------------------------------------
   //  Getter methods
   // ---------------------------------------------------------------------------
  @@ -622,14 +624,10 @@
   
   inline void XMLAttDef::setEnumeration(const XMLCh* const newValue)
   {
  -    delete [] fEnumeration;
  +    if (fEnumeration)
  +        XMLString::release(&fEnumeration);
   
  -    if (newValue) {
  -        fEnumeration = XMLString::replicate(newValue);
  -    }
  -    else {
  -        fEnumeration = 0;
  -    }
  +    fEnumeration = XMLString::replicate(newValue);
   }
   
   inline void XMLAttDef::setId(const unsigned int newId)
  @@ -649,7 +647,9 @@
   
   inline void XMLAttDef::setValue(const XMLCh* const newValue)
   {
  -    delete [] fValue;
  +    if (fValue)
  +       XMLString::release(&fValue);
  +
       fValue = XMLString::replicate(newValue);
   }
   
  
  
  
  1.4       +32 -35    xml-xerces/c/src/xercesc/framework/XMLEntityDecl.cpp
  
  Index: XMLEntityDecl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLEntityDecl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLEntityDecl.cpp	4 Nov 2002 15:00:21 -0000	1.3
  +++ XMLEntityDecl.cpp	21 Apr 2003 20:46:01 -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
  @@ -62,10 +62,9 @@
   // ---------------------------------------------------------------------------
   //  Includes
   // ---------------------------------------------------------------------------
  -#include <xercesc/util/XMLUniDefs.hpp>
  -#include <xercesc/util/XMLUni.hpp>
  -#include <xercesc/util/XMLString.hpp>
   #include <xercesc/framework/XMLEntityDecl.hpp>
  +#include <xercesc/util/XMLUniDefs.hpp>
  +
   
   XERCES_CPP_NAMESPACE_BEGIN
   
  @@ -74,46 +73,45 @@
   // ---------------------------------------------------------------------------
   XMLEntityDecl::XMLEntityDecl() :
   
  -    fName(0)
  +    fId(0)
  +    , fValueLen(0)
  +    , fValue(0)
  +    , fName(0)
       , fNotationName(0)
       , fPublicId(0)
       , fSystemId(0)
       , fBaseURI(0)
  -    , fValue(0)
  -    , fValueLen(0)
   {
   }
   
   XMLEntityDecl::XMLEntityDecl(const XMLCh* const entName) :
   
  -    fName(0)
  +    fId(0)
  +    , fValueLen(0)
  +    , fValue(0)
  +    , fName(XMLString::replicate(entName))
       , fNotationName(0)
       , fPublicId(0)
       , fSystemId(0)
       , fBaseURI(0)
  -    , fValue(0)
  -    , fValueLen(0)
   {
  -    fName = XMLString::replicate(entName);
   }
   
   XMLEntityDecl::XMLEntityDecl(const  XMLCh* const    entName
                               , const XMLCh* const    value) :
  -    fName(0)
  +    fId(0)
  +    , fValueLen(XMLString::stringLen(value))
  +    , fValue(XMLString::replicate(value))
  +    , fName(0)
       , fNotationName(0)
       , fPublicId(0)
       , fSystemId(0)
       , fBaseURI(0)
  -    , fValue(0)
  -    , fValueLen(0)
   {
       try
       {
           fName = XMLString::replicate(entName);
  -        fValue = XMLString::replicate(value);
  -        fValueLen = XMLString::stringLen(value);
       }
  -
       catch(...)
       {
           cleanUp();
  @@ -122,23 +120,21 @@
   
   XMLEntityDecl::XMLEntityDecl(const  XMLCh* const    entName
                               , const XMLCh           value) :
  -    fName(0)
  +    fId(0)
  +    , fValueLen(1)
  +    , fValue(0)
  +    , fName(XMLString::replicate(entName))
       , fNotationName(0)
       , fPublicId(0)
       , fSystemId(0)
       , fBaseURI(0)
  -    , fValue(0)
  -    , fValueLen(0)
   {
       try
       {
  -        fValue = new XMLCh[2];
  -        fValue[0] = value;
  -        fValue[1] = chNull;
  -        fValueLen = 1;
  -        fName = XMLString::replicate(entName);
  +        XMLCh dummy[2] = { chNull, chNull };
  +        dummy[0] = value;
  +        fValue = XMLString::replicate(dummy);
       }
  -
       catch(...)
       {
           cleanUp();
  @@ -157,8 +153,9 @@
   void XMLEntityDecl::setName(const XMLCh* const entName)
   {
       // Clean up the current name stuff
  -    delete [] fName;
  -    fName = 0;
  +    if (fName)
  +       XMLString::release(&fName);
  +
       fName = XMLString::replicate(entName);
   }
   
  @@ -168,12 +165,12 @@
   // ---------------------------------------------------------------------------
   void XMLEntityDecl::cleanUp()
   {
  -    delete [] fName;
  -    delete [] fNotationName;
  -    delete [] fValue;
  -    delete [] fPublicId;
  -    delete [] fSystemId;
  -    delete [] fBaseURI;
  +    XMLString::release(&fName);
  +    XMLString::release(&fNotationName);
  +    XMLString::release(&fValue);
  +    XMLString::release(&fPublicId);
  +    XMLString::release(&fSystemId);
  +    XMLString::release(&fBaseURI);
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.5       +22 -9     xml-xerces/c/src/xercesc/framework/XMLEntityDecl.hpp
  
  Index: XMLEntityDecl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLEntityDecl.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLEntityDecl.hpp	7 Mar 2003 18:08:10 -0000	1.4
  +++ XMLEntityDecl.hpp	21 Apr 2003 20:46:01 -0000	1.5
  @@ -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.5  2003/04/21 20:46:01  knoaman
  + * Use XMLString::release to prepare for configurable memory manager.
  + *
    * Revision 1.4  2003/03/07 18:08:10  tng
    * Return a reference instead of void for operator=
    *
  @@ -413,12 +416,12 @@
       //      is the URI where it is declared (NOT referenced).
       // -----------------------------------------------------------------------
       unsigned int    fId;
  -	XMLCh*          fName;
  +    unsigned int    fValueLen;
  +    XMLCh*          fValue;
  +    XMLCh*          fName;
       XMLCh*          fNotationName;
       XMLCh*          fPublicId;
       XMLCh*          fSystemId;
  -    XMLCh*          fValue;
  -    unsigned int    fValueLen;
       XMLCh*          fBaseURI;
   };
   
  @@ -489,31 +492,41 @@
   
   inline void XMLEntityDecl::setNotationName(const XMLCh* const newName)
   {
  -    delete [] fNotationName;
  +    if (fNotationName)
  +        XMLString::release(&fNotationName);
  +
       fNotationName = XMLString::replicate(newName);
   }
   
   inline void XMLEntityDecl::setPublicId(const XMLCh* const newId)
   {
  -    delete [] fPublicId;
  +    if (fPublicId)
  +        XMLString::release(&fPublicId);
  +
       fPublicId = XMLString::replicate(newId);
   }
   
   inline void XMLEntityDecl::setSystemId(const XMLCh* const newId)
   {
  -    delete [] fSystemId;
  +    if (fSystemId)
  +        XMLString::release(&fSystemId);
  +
       fSystemId = XMLString::replicate(newId);
   }
   
   inline void XMLEntityDecl::setBaseURI(const XMLCh* const newId)
   {
  -    delete [] fBaseURI;
  +    if (fBaseURI)
  +        XMLString::release(&fBaseURI);
  +
       fBaseURI = XMLString::replicate(newId);
   }
   
   inline void XMLEntityDecl::setValue(const XMLCh* const newValue)
   {
  -    delete [] fValue;
  +    if (fValue)
  +        XMLString::release(&fValue);
  +
       fValue = XMLString::replicate(newValue);
       fValueLen = XMLString::stringLen(newValue);
   }
  
  
  
  1.4       +15 -11    xml-xerces/c/src/xercesc/framework/XMLNotationDecl.cpp
  
  Index: XMLNotationDecl.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLNotationDecl.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XMLNotationDecl.cpp	4 Nov 2002 15:00:21 -0000	1.3
  +++ XMLNotationDecl.cpp	21 Apr 2003 20:46:01 -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/04/21 20:46:01  knoaman
  + * Use XMLString::release to prepare for configurable memory manager.
  + *
    * Revision 1.3  2002/11/04 15:00:21  tng
    * C++ Namespace Support.
    *
  @@ -89,7 +92,8 @@
   // ---------------------------------------------------------------------------
   XMLNotationDecl::XMLNotationDecl() :
   
  -    fName(0)
  +    fId(0)
  +    , fName(0)
       , fPublicId(0)
       , fSystemId(0)
       , fBaseURI(0)
  @@ -100,7 +104,8 @@
                                       , const XMLCh* const    pubId
                                       , const XMLCh* const    sysId
                                       , const XMLCh* const    baseURI) :
  -    fName(0)
  +    fId(0)
  +    , fName(XMLString::replicate(notName))
       , fPublicId(0)
       , fSystemId(0)
       , fBaseURI(0)
  @@ -110,9 +115,7 @@
           fPublicId = XMLString::replicate(pubId);
           fSystemId = XMLString::replicate(sysId);
           fBaseURI  = XMLString::replicate(baseURI);
  -        setName(notName);
       }
  -
       catch(...)
       {
           cleanUp();
  @@ -131,8 +134,9 @@
   void XMLNotationDecl::setName(const XMLCh* const notName)
   {
       // Clean up the current name stuff and replicate the passed name
  -    delete [] fName;
  -    fName = 0;
  +    if (fName)
  +        XMLString::release(&fName);
  +
       fName = XMLString::replicate(notName);
   }
   
  @@ -143,10 +147,10 @@
   // ---------------------------------------------------------------------------
   void XMLNotationDecl::cleanUp()
   {
  -    delete [] fName;
  -    delete [] fPublicId;
  -    delete [] fSystemId;
  -    delete [] fBaseURI;
  +    XMLString::release(&fName);
  +    XMLString::release(&fPublicId);
  +    XMLString::release(&fSystemId);
  +    XMLString::release(&fBaseURI);
   }
   
   XERCES_CPP_NAMESPACE_END
  
  
  
  1.5       +13 -5     xml-xerces/c/src/xercesc/framework/XMLNotationDecl.hpp
  
  Index: XMLNotationDecl.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLNotationDecl.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLNotationDecl.hpp	7 Mar 2003 18:08:10 -0000	1.4
  +++ XMLNotationDecl.hpp	21 Apr 2003 20:46:01 -0000	1.5
  @@ -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.5  2003/04/21 20:46:01  knoaman
  + * Use XMLString::release to prepare for configurable memory manager.
  + *
    * Revision 1.4  2003/03/07 18:08:10  tng
    * Return a reference instead of void for operator=
    *
  @@ -93,7 +96,6 @@
   #if !defined(XMLNOTATIONDECL_HPP)
   #define XMLNOTATIONDECL_HPP
   
  -#include <xercesc/util/XercesDefs.hpp>
   #include <xercesc/util/XMLString.hpp>
   
   XERCES_CPP_NAMESPACE_BEGIN
  @@ -241,19 +243,25 @@
   
   inline void XMLNotationDecl::setPublicId(const XMLCh* const newId)
   {
  -    delete [] fPublicId;
  +    if (fPublicId)
  +        XMLString::release(&fPublicId);
  +
       fPublicId = XMLString::replicate(newId);
   }
   
   inline void XMLNotationDecl::setSystemId(const XMLCh* const newId)
   {
  -    delete [] fSystemId;
  +    if (fSystemId)
  +        XMLString::release(&fSystemId);
  +
       fSystemId = XMLString::replicate(newId);
   }
   
   inline void XMLNotationDecl::setBaseURI(const XMLCh* const newId)
   {
  -    delete [] fBaseURI;
  +    if (fBaseURI)
  +        XMLString::release(&fBaseURI);
  +
       fBaseURI = XMLString::replicate(newId);
   }
   
  
  
  
  1.5       +7 -4      xml-xerces/c/src/xercesc/framework/XMLRefInfo.hpp
  
  Index: XMLRefInfo.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/framework/XMLRefInfo.hpp,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XMLRefInfo.hpp	7 Mar 2003 18:08:10 -0000	1.4
  +++ XMLRefInfo.hpp	21 Apr 2003 20:46:01 -0000	1.5
  @@ -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.5  2003/04/21 20:46:01  knoaman
  + * Use XMLString::release to prepare for configurable memory manager.
  + *
    * Revision 1.4  2003/03/07 18:08:10  tng
    * Return a reference instead of void for operator=
    *
  @@ -173,8 +176,8 @@
       //      a declared ID.
       // -----------------------------------------------------------------------
       bool        fDeclared;
  -    XMLCh*      fRefName;
       bool        fUsed;
  +    XMLCh*      fRefName;
   };
   
   
  @@ -185,14 +188,14 @@
                                   , const bool            declared
                                   , const bool            used) :
       fDeclared(declared)
  -    , fRefName(XMLString::replicate(refName))
       , fUsed(used)
  +    , fRefName(XMLString::replicate(refName))
   {
   }
   
   inline XMLRefInfo::~XMLRefInfo()
   {
  -    delete [] fRefName;
  +    XMLString::release(&fRefName);
   }
   
   
  
  
  

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