You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ga...@apache.org on 2003/10/02 13:07:26 UTC
cvs commit: xml-xerces/c/src/xercesc/util XMLString.cpp XMLString.hpp
gareth 2003/10/02 04:07:26
Modified: c/src/xercesc/util XMLString.cpp XMLString.hpp
Log:
Made the non-memory manager version of replicate not inlined. Updated the documentation for the memory manager versions so they don't tell you you should call release.
Revision Changes Path
1.25 +14 -1 xml-xerces/c/src/xercesc/util/XMLString.cpp
Index: XMLString.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLString.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- XMLString.cpp 1 Oct 2003 00:22:20 -0000 1.24
+++ XMLString.cpp 2 Oct 2003 11:07:26 -0000 1.25
@@ -491,6 +491,19 @@
}
+XMLCh* XMLString::replicate(const XMLCh* const toRep)
+{
+ // If a null string, return a null string!
+ XMLCh* ret = 0;
+ if (toRep)
+ {
+ const unsigned int len = stringLen(toRep);
+ ret = new XMLCh[len + 1];
+ memcpy(ret, toRep, (len + 1) * sizeof(XMLCh));
+ }
+ return ret;
+}
+
char* XMLString::replicate(const char* const toRep)
{
// If a null string, return a null string
1.20 +38 -27 xml-xerces/c/src/xercesc/util/XMLString.hpp
Index: XMLString.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLString.hpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- XMLString.hpp 1 Oct 2003 00:22:20 -0000 1.19
+++ XMLString.hpp 2 Oct 2003 11:07:26 -0000 1.20
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.20 2003/10/02 11:07:26 gareth
+ * Made the non-memory manager version of replicate not inlined. Updated the documentation for the memory manager versions so they don't tell you you should call release.
+ *
* Revision 1.19 2003/10/01 00:22:20 knoaman
* Add a lastIndexOf method that takes the string length as one of the params.
*
@@ -839,6 +842,17 @@
* @see XMLString::release(char**)
*/
static char* replicate(const char* const toRep);
+
+
+
+ /** Replicates a string
+ * NOTE: The returned buffer is allocated with the MemoryManager. It is the
+ * responsibility of the caller to delete it when not longer needed.
+ *
+ * @param toRep The string to replicate
+ * @param manager The MemoryManager to use to allocate the string
+ * @return Returns a pointer to the replicated string
+ */
static char* replicate(const char* const toRep,
MemoryManager* const manager);
@@ -852,6 +866,16 @@
* @see XMLString::release(XMLCh**)
*/
static XMLCh* replicate(const XMLCh* const toRep);
+
+
+ /** Replicates a string
+ * NOTE: The returned buffer is allocated with the MemoryManager. It is the
+ * responsibility of the caller to delete it when not longer needed.
+ *
+ * @param toRep The string to replicate
+ * @param manager The MemoryManager to use to allocate the string
+ * @return Returns a pointer to the replicated string
+ */
static XMLCh* replicate(const XMLCh* const toRep,
MemoryManager* const manager);
@@ -1531,6 +1555,20 @@
}
}
+inline XMLCh* XMLString::replicate(const XMLCh* const toRep,
+ MemoryManager* const manager)
+{
+ // If a null string, return a null string!
+ XMLCh* ret = 0;
+ if (toRep)
+ {
+ const unsigned int len = stringLen(toRep);
+ ret = (XMLCh*) manager->allocate((len+1) * sizeof(XMLCh)); //new XMLCh[len + 1];
+ memcpy(ret, toRep, (len + 1) * sizeof(XMLCh));
+ }
+ return ret;
+}
+
inline bool XMLString::startsWith( const XMLCh* const toTest
, const XMLCh* const prefix)
{
@@ -1551,33 +1589,6 @@
return regionMatches(toTest, XMLString::stringLen(toTest) - suffixLen,
suffix, 0, suffixLen);
-}
-
-inline XMLCh* XMLString::replicate(const XMLCh* const toRep)
-{
- // If a null string, return a null string!
- XMLCh* ret = 0;
- if (toRep)
- {
- const unsigned int len = stringLen(toRep);
- ret = new XMLCh[len + 1];
- memcpy(ret, toRep, (len + 1) * sizeof(XMLCh));
- }
- return ret;
-}
-
-inline XMLCh* XMLString::replicate(const XMLCh* const toRep,
- MemoryManager* const manager)
-{
- // If a null string, return a null string!
- XMLCh* ret = 0;
- if (toRep)
- {
- const unsigned int len = stringLen(toRep);
- ret = (XMLCh*) manager->allocate((len+1) * sizeof(XMLCh)); //new XMLCh[len + 1];
- memcpy(ret, toRep, (len + 1) * sizeof(XMLCh));
- }
- return ret;
}
inline bool XMLString::validateRegion(const XMLCh* const str1,
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org