kdelibs/kdecore

Harri Porten kde-optimize@mail.kde.org
Wed, 19 Mar 2003 21:48:40 +0100 (CET)


On Wed, 19 Mar 2003, Eray Ozkural wrote:

> --- kdelibs/kdecore/netwm.cpp  #1.84:1.85
> @@ -475,5 +475,7 @@ Z &NETRArray<Z>::operator[](int index) {
>      } else if (index >= sz) {
>          // allocate space for the new data
> -        Z *newdata = new Z[index + 1];
> +        // open table has amortized O(1) access time
> +        // when N elements appended -- exa
> +        Z *newdata = new Z[max(2 * sz, index+1)];
>  
>          // move the old data into the new array

What difference does this patch make ? I don't see how the extra space is
being used.

Harri.