From abce2a9428f62251b92aa67088c93181a7aedc9c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 19 Nov 2017 22:02:26 +0100 Subject: [PATCH] Use the same growth strategy in wxArrayString as in wxVector Remove maximal reallocation size in wxArrayString too, as it was done for wxVector a commit ago, and increase its size by 100% and not 50% when it needs to grow. There is no real reason to use different growth strategies in the two classes and wxVector one seems to be better. --- src/common/arrstr.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/common/arrstr.cpp b/src/common/arrstr.cpp index 6b3abce10c..cdb9590eaf 100644 --- a/src/common/arrstr.cpp +++ b/src/common/arrstr.cpp @@ -57,9 +57,6 @@ wxArrayString::wxArrayString(size_t sz, const wxString* a) #if !wxUSE_STD_CONTAINERS -// size increment = min(50% of current size, ARRAY_MAXSIZE_INCREMENT) -#define ARRAY_MAXSIZE_INCREMENT 4096 - #ifndef ARRAY_DEFAULT_INITIAL_SIZE // also defined in dynarray.h #define ARRAY_DEFAULT_INITIAL_SIZE (16) #endif @@ -139,11 +136,8 @@ wxString *wxArrayString::Grow(size_t nIncrement) else { // otherwise when it's called for the first time, nIncrement would be 0 // and the array would never be expanded - // add 50% but not too much size_t ndefIncrement = m_nSize < ARRAY_DEFAULT_INITIAL_SIZE - ? ARRAY_DEFAULT_INITIAL_SIZE : m_nSize >> 1; - if ( ndefIncrement > ARRAY_MAXSIZE_INCREMENT ) - ndefIncrement = ARRAY_MAXSIZE_INCREMENT; + ? ARRAY_DEFAULT_INITIAL_SIZE : m_nSize; if ( nIncrement < ndefIncrement ) nIncrement = ndefIncrement; m_nSize += nIncrement;