? stringpool.diff
? growbuf.diff
Index: ut_bytebuf.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_bytebuf.cpp,v
retrieving revision 1.6
diff -r1.6 ut_bytebuf.cpp
57c57
< 	UT_uint32 newSize = ((m_iSpace+spaceNeeded+m_iChunk-1)/m_iChunk)*m_iChunk;
---
> 	UT_uint32 newSize = ((m_iSize+spaceNeeded+m_iChunk-1)/m_iChunk)*m_iChunk;
123a124
> 
135c136,142
< 	// TODO consider adding some stuff to realloc-down if we cross a good-sized threshold.
---
> 	UT_uint32 newSpace = ((m_iSize+m_iChunk-1)/m_iChunk)*m_iChunk; //Calculate the new space needed
> 	if (newSpace != m_iSpace)
> 	{
> 		m_pBuf = (UT_Byte *)realloc(m_pBuf, newSpace*sizeof(*m_pBuf));  //Re-allocate to the smaller size
> 		m_iSpace = newSpace; //update m_iSpace to the new figure
> 	}
> 
182c189,194
< 	// TODO consider reallocing down
---
> 	UT_uint32 newSpace = ((m_iSize+m_iChunk-1)/m_iChunk)*m_iChunk; //Calculate the new space needed
> 	if (newSpace != m_iSpace)
> 	{
> 		m_pBuf = (UT_Byte *)realloc(m_pBuf, newSpace*sizeof(*m_pBuf));  //Re-allocate to the smaller size
> 		m_iSpace = newSpace; //update m_iSpace to the new figure
> 	}
Index: ut_growbuf.cpp
===================================================================
RCS file: /cvsroot/abi/src/af/util/xp/ut_growbuf.cpp,v
retrieving revision 1.12
diff -r1.12 ut_growbuf.cpp
57c57
< 	UT_uint32 newSize = ((m_iSpace+spaceNeeded+m_iChunk-1)/m_iChunk)*m_iChunk;
---
> 	UT_uint32 newSize = ((m_iSize+spaceNeeded+m_iChunk-1)/m_iChunk)*m_iChunk;
135c135,140
< 	// TODO consider adding some stuff to realloc-down if we cross a good-sized threshold.
---
> 	UT_uint32 newSpace = ((m_iSize+m_iChunk-1)/m_iChunk)*m_iChunk; //Calculate the new space needed
> 	if (newSpace != m_iSpace)
> 	{
> 		m_pBuf = (UT_uint16 *)realloc(m_pBuf, newSpace*sizeof(*m_pBuf));  //Re-allocate to the smaller size
> 		m_iSpace = newSpace; //update m_iSpace to the new figure
> 	}
182c187,192
< 	// TODO consider reallocing down
---
> 	UT_uint32 newSpace = ((m_iSize+m_iChunk-1)/m_iChunk)*m_iChunk; //Calculate the new space needed
> 	if (newSpace != m_iSpace)
> 	{
> 		m_pBuf = (UT_uint16 *)realloc(m_pBuf, newSpace*sizeof(*m_pBuf));  //Re-allocate to the smaller size
> 		m_iSpace = newSpace; //update m_iSpace to the new figure
> 	}