internal int FindDocument(ISymbolDocumentWriter document)
{
int i;
// This is an optimization. The chance that the previous line is coming from the same
// document is very high.
//
if (m_iLastFound < m_DocumentCount && m_Documents[m_iLastFound] == document)
return m_iLastFound;
for (i = 0; i < m_DocumentCount; i++)
{
if (m_Documents[i].m_document == document)
{
m_iLastFound = i;
return m_iLastFound;
}
}
// cannot find an existing document so add one to the array
EnsureCapacity();
m_iLastFound = m_DocumentCount;
m_Documents[m_DocumentCount++] = new REDocument(document);
return m_iLastFound;
}