From feb49215a67c55bbe3883a92d483da7f7df2c471 Mon Sep 17 00:00:00 2001 From: cxl Date: Mon, 7 Sep 2009 08:37:38 +0000 Subject: [PATCH] Core: Fixed inefficiency in Vector::SetCountR (and thus in Vector::At) git-svn-id: svn://ultimatepp.org/upp/trunk@1563 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/Vcont.hpp | 2 +- uppsrc/CtrlLib/ArrayCtrl.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/uppsrc/Core/Vcont.hpp b/uppsrc/Core/Vcont.hpp index f8a96940d..a163f0f97 100644 --- a/uppsrc/Core/Vcont.hpp +++ b/uppsrc/Core/Vcont.hpp @@ -162,7 +162,7 @@ void Vector::SetCount(int n, const T& init) { template void Vector::SetCountR(int n) { Chk(); - if(n + items > alloc) + if(n > alloc) ReAllocF(alloc + ntl_max(alloc, n - items)); SetCount(n); } diff --git a/uppsrc/CtrlLib/ArrayCtrl.cpp b/uppsrc/CtrlLib/ArrayCtrl.cpp index 98c48c10c..a955510cc 100644 --- a/uppsrc/CtrlLib/ArrayCtrl.cpp +++ b/uppsrc/CtrlLib/ArrayCtrl.cpp @@ -1755,7 +1755,6 @@ void ArrayCtrl::Add() { InvalidateCache(i); RefreshRow(i); } - } void ArrayCtrl::Add(const Vector& v)