- // we rely on a reasonable realloc() implementation here - so far I haven't
- // seen any which wouldn't behave like this
+ if ( p == NULL) {
+ wxFAIL_MSG( _T("out of memory reallocating wxString data") );
+ // keep previous data since reallocation failed
+ return FALSE;
+ }
+
+ if ( p != pData )
+ {
+ // contrary to what one might believe, some realloc() implementation do
+ // move the memory block even when its size is reduced
+ pData = (wxStringData *)p;