You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2001/01/24 00:18:49 UTC
cvs commit: xml-xalan/c/src/PlatformSupport NamedNodeMapAttributeList.cpp NamedNodeMapAttributeList.hpp
dbertoni 01/01/23 15:18:49
Modified: c/src/PlatformSupport NamedNodeMapAttributeList.cpp
NamedNodeMapAttributeList.hpp
Log:
Fixed bug where growing vector would invalidate strings already present. Fixed by removing cached strings altogether, as we no longer need to cache them.
Revision Changes Path
1.12 +4 -23 xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.cpp
Index: NamedNodeMapAttributeList.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- NamedNodeMapAttributeList.cpp 2001/01/08 18:14:18 1.11
+++ NamedNodeMapAttributeList.cpp 2001/01/23 23:18:39 1.12
@@ -69,8 +69,7 @@
NamedNodeMapAttributeList::NamedNodeMapAttributeList(const XalanNamedNodeMap& theMap) :
m_nodeMap(theMap),
- m_lastIndex(theMap.getLength() - 1),
- m_cachedData()
+ m_lastIndex(theMap.getLength() - 1)
{
}
@@ -105,9 +104,7 @@
#endif
assert(theAttribute != 0);
- cacheData(theAttribute->getName());
-
- return c_wstr(m_cachedData.back());
+ return c_wstr(theAttribute->getName());
}
@@ -132,10 +129,8 @@
static_cast<const XalanAttr*>(m_nodeMap.item(m_lastIndex - index));
#endif
assert(theAttribute != 0);
-
- cacheData(theAttribute->getValue());
- return c_wstr(m_cachedData.back());
+ return c_wstr(theAttribute->getValue());
}
@@ -171,10 +166,8 @@
#else
static_cast<const XalanAttr*>(theNode);
#endif
-
- cacheData(theAttribute->getValue());
- return c_wstr(m_cachedData.back());
+ return c_wstr(theAttribute->getValue());
}
}
@@ -184,18 +177,6 @@
NamedNodeMapAttributeList::getValue(const char* const name) const
{
return getValue(c_wstr(TranscodeFromLocalCodePage(name)));
-}
-
-
-
-void
-NamedNodeMapAttributeList::cacheData(const XalanDOMString& theData) const
-{
-#if defined(XALAN_NO_MUTABLE)
- ((NamedNodeMapAttributeList*)this)->m_cachedData.push_back(theData);
-#else
- m_cachedData.push_back(theData);
-#endif
}
1.6 +1 -14 xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.hpp
Index: NamedNodeMapAttributeList.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/PlatformSupport/NamedNodeMapAttributeList.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- NamedNodeMapAttributeList.hpp 2000/09/05 02:24:45 1.5
+++ NamedNodeMapAttributeList.hpp 2001/01/23 23:18:42 1.6
@@ -129,9 +129,6 @@
private:
- void
- cacheData(const XalanDOMString& theData) const;
-
// Not implemented...
NamedNodeMapAttributeList&
operator=(const NamedNodeMapAttributeList&);
@@ -141,18 +138,8 @@
// Data members...
const XalanNamedNodeMap& m_nodeMap;
-
- const int m_lastIndex;
-
-#if defined(XALAN_NO_NAMESPACES)
- typedef XalanDOMString CacheEntryType;
- typedef vector<CacheEntryType> CacheType;
-#else
- typedef XalanDOMString CacheEntryType;
- typedef std::vector<CacheEntryType> CacheType;
-#endif
- mutable CacheType m_cachedData;
+ const unsigned int m_lastIndex;
static const XalanDOMString& s_typeString;
};