dbertoni    2002/10/03 18:35:42

  Modified:    c/src/XercesParserLiaison XercesWrapperNavigator.cpp
                        XercesWrapperNavigator.hpp
  Log:
  Don't cache pointers.
  
  Revision  Changes    Path
  1.3       +36 -56    
xml-xalan/c/src/XercesParserLiaison/XercesWrapperNavigator.cpp
  
  Index: XercesWrapperNavigator.cpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesWrapperNavigator.cpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XercesWrapperNavigator.cpp        3 Oct 2002 05:58:53 -0000       1.2
  +++ XercesWrapperNavigator.cpp        4 Oct 2002 01:35:42 -0000       1.3
  @@ -73,26 +73,16 @@
   const XalanDOMString XercesWrapperNavigator::s_emptyString;
   
   
  -// I'm using this to distinguish between null nodes, which are valid, and
  -// an uninitialized cached node address.  This is pretty bogus, and I'll
  -// probably just change this to 0, but this is experimental anyway...
  -#if defined(XALAN_OLD_STYLE_CASTS)
  -static XalanNode* const              invalidNodeAddress = (XalanNode*)1;
  -#else
  -static XalanNode* const              invalidNodeAddress = 
reinterpret_cast<XalanNode*>(1);
  -#endif
  -
  -
   
   XercesWrapperNavigator::XercesWrapperNavigator(
                        XercesDocumentWrapper*  theOwnerDocument,
                        bool                                    mappingMode) :
        m_ownerDocument(theOwnerDocument),
  -     m_parentNode(mappingMode == true ? invalidNodeAddress : 0),
  -     m_previousSibling(mappingMode == true ? invalidNodeAddress : 0),
  -     m_nextSibling(mappingMode == true ? invalidNodeAddress : 0),
  -     m_firstChild(mappingMode == true ? invalidNodeAddress : 0),
  -     m_lastChild(mappingMode == true ? invalidNodeAddress : 0),
  +     m_parentNode(0),
  +     m_previousSibling(0),
  +     m_nextSibling(0),
  +     m_firstChild(0),
  +     m_lastChild(0),
        m_index(UINT_MAX)
   {
        assert(theOwnerDocument != 0);
  @@ -154,16 +144,14 @@
   XalanNode*
   XercesWrapperNavigator::getParentNode(const DOMNode* theXercesNode) const
   {
  -     if (m_parentNode == invalidNodeAddress)
  +     if (m_parentNode == 0)
        {
  -#if defined(XALAN_NO_MUTABLE)
  -             ((XercesWrapperNavigator*)this)->m_parentNode = 
m_ownerDocument->mapNode(theXercesNode->getParentNode());
  -#else
  -             m_parentNode = 
m_ownerDocument->mapNode(theXercesNode->getParentNode());
  -#endif
  +             return m_ownerDocument->mapNode(theXercesNode->getParentNode());
  +     }
  +     else
  +     {
  +             return m_parentNode;
        }
  -
  -     return m_parentNode;
   }
   
   
  @@ -171,16 +159,14 @@
   XalanNode*
   XercesWrapperNavigator::getPreviousSibling(const DOMNode*    theXercesNode) 
const
   {
  -     if (m_previousSibling == invalidNodeAddress)
  +     if (m_previousSibling == 0)
        {
  -#if defined(XALAN_NO_MUTABLE)
  -             ((XercesWrapperNavigator*)this)->m_previousSibling = 
m_ownerDocument->mapNode(theXercesNode->getPreviousSibling());
  -#else
  -             m_previousSibling = 
m_ownerDocument->mapNode(theXercesNode->getPreviousSibling());
  -#endif
  +             return 
m_ownerDocument->mapNode(theXercesNode->getPreviousSibling());
  +     }
  +     else
  +     {
  +             return m_previousSibling;
        }
  -
  -     return m_previousSibling;
   }
   
   
  @@ -188,16 +174,14 @@
   XalanNode*
   XercesWrapperNavigator::getNextSibling(const DOMNode*        theXercesNode) 
const
   {
  -     if (m_nextSibling == invalidNodeAddress)
  +     if (m_nextSibling == 0)
        {
  -#if defined(XALAN_NO_MUTABLE)
  -             ((XercesWrapperNavigator*)this)->m_nextSibling = 
m_ownerDocument->mapNode(theXercesNode->getNextSibling());
  -#else
  -             m_nextSibling = 
m_ownerDocument->mapNode(theXercesNode->getNextSibling());
  -#endif
  +             return 
m_ownerDocument->mapNode(theXercesNode->getNextSibling());
  +     }
  +     else
  +     {
  +             return m_nextSibling;
        }
  -
  -     return m_nextSibling;
   }
   
   
  @@ -205,16 +189,14 @@
   XalanNode*
   XercesWrapperNavigator::getFirstChild(const DOMNode* theXercesNode) const
   {
  -     if (m_firstChild == invalidNodeAddress)
  +     if (m_firstChild == 0)
        {
  -#if defined(XALAN_NO_MUTABLE)
  -             ((XercesWrapperNavigator*)this)->m_firstChild = 
m_ownerDocument->mapNode(theXercesNode->getFirstChild());
  -#else
  -             m_firstChild = 
m_ownerDocument->mapNode(theXercesNode->getFirstChild());
  -#endif
  +             return m_ownerDocument->mapNode(theXercesNode->getFirstChild());
  +     }
  +     else
  +     {
  +             return m_firstChild;
        }
  -
  -     return m_firstChild;
   }
   
   
  @@ -222,16 +204,14 @@
   XalanNode*
   XercesWrapperNavigator::getLastChild(const DOMNode*  theXercesNode) const
   {
  -     if (m_lastChild == invalidNodeAddress)
  +     if (m_lastChild == 0)
        {
  -#if defined(XALAN_NO_MUTABLE)
  -             ((XercesWrapperNavigator*)this)->m_lastChild = 
m_ownerDocument->mapNode(theXercesNode->getLastChild());
  -#else
  -             m_lastChild = 
m_ownerDocument->mapNode(theXercesNode->getLastChild());
  -#endif
  +             return m_ownerDocument->mapNode(theXercesNode->getLastChild());
  +     }
  +     else
  +     {
  +             return m_lastChild;
        }
  -
  -     return m_lastChild;
   }
   
   
  @@ -241,7 +221,7 @@
   {
        assert(theXercesAttr != 0);
   
  -     if (m_parentNode != invalidNodeAddress)
  +     if (m_parentNode != 0)
        {
                assert(m_parentNode->getNodeType() == XalanNode::ELEMENT_NODE);
   
  
  
  
  1.3       +7 -7      
xml-xalan/c/src/XercesParserLiaison/XercesWrapperNavigator.hpp
  
  Index: XercesWrapperNavigator.hpp
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/c/src/XercesParserLiaison/XercesWrapperNavigator.hpp,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XercesWrapperNavigator.hpp        3 Oct 2002 05:58:53 -0000       1.2
  +++ XercesWrapperNavigator.hpp        4 Oct 2002 01:35:42 -0000       1.3
  @@ -232,19 +232,19 @@
        operator==(const XercesWrapperNavigator&        theRHS) const;
   
        // Data members...
  -     XercesDocumentWrapper*          m_ownerDocument;
  +     XercesDocumentWrapper*  m_ownerDocument;
   
  -     mutable XalanNode*                      m_parentNode;
  +     XalanNode*                              m_parentNode;
   
  -     mutable XalanNode*                      m_previousSibling;
  +     XalanNode*                              m_previousSibling;
   
  -     mutable XalanNode*                      m_nextSibling;
  +     XalanNode*                              m_nextSibling;
   
  -     mutable XalanNode*                      m_firstChild;
  +     XalanNode*                              m_firstChild;
   
  -     mutable XalanNode*                      m_lastChild;
  +     XalanNode*                              m_lastChild;
   
  -     unsigned long                           m_index;
  +     unsigned long                   m_index;
   
        const static XalanDOMString     s_emptyString;
   };
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to