peiyongz 2003/06/25 10:44:04
Modified: c/src/xercesc/validators/common GrammarResolver.cpp
Log:
cacheGrammar() revised
Revision Changes Path
1.11 +22 -7 xml-xerces/c/src/xercesc/validators/common/GrammarResolver.cpp
Index: GrammarResolver.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/common/GrammarResolver.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- GrammarResolver.cpp 23 Jun 2003 15:53:50 -0000 1.10
+++ GrammarResolver.cpp 25 Jun 2003 17:44:04 -0000 1.11
@@ -57,6 +57,9 @@
/*
* $Log$
+ * Revision 1.11 2003/06/25 17:44:04 peiyongz
+ * cacheGrammar() revised
+ *
* Revision 1.10 2003/06/23 15:53:50 peiyongz
* clean up temporary XMLGrammarDescription to make MemoryTest happy
*
@@ -283,25 +286,37 @@
void GrammarResolver::cacheGrammars()
{
+
RefHashTableOfEnumerator<GrammarEntry> grammarEnum(fGrammarBucket);
+ ValueVectorOf<XMLCh*> keys(8, fMemoryManager);
+ unsigned int keyCount = 0;
- /***
- * It is up to the GrammarPool to handle duplicated grammar
- *
- * Destroy the grammarEntry but reuse the grammar and description
- * embedded.
- *
- */
+ // Build key set
while (grammarEnum.hasMoreElements())
{
XMLCh* grammarKey = (XMLCh*) grammarEnum.nextElementKey();
+ keys.addElement(grammarKey);
+ keyCount++;
+ }
+
+ // Cache
+ for (unsigned int i = 0; i < keyCount; i++)
+ {
+ XMLCh* grammarKey = keys.elementAt(i);
GrammarEntry* theEntry = fGrammarBucket->orphanKey(grammarKey);
+
+ /***
+ * Destroy the grammarEntry but retain the grammar/description
+ */
XMLGrammarDescription* description = theEntry->getDescription();
Grammar* grammar = theEntry->getGrammar();
theEntry->nullGrammar();
theEntry->nullDescription();
delete theEntry;
+ /***
+ * It is up to the GrammarPool implementation to handle duplicated grammar
+ */
fGrammarPool->cacheGrammar(description, grammar);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]