From 560565219161bc9fffb2bebda1fc13150059ba09 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Mon, 10 Jul 2000 12:34:21 +0000 Subject: Dropped template as only ever instantiated for int and this allows Scintilla to be template free. --- src/CellBuffer.h | 2 +- src/SVector.h | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 7a3eabaeb..acac9fa2f 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -144,7 +144,7 @@ private: LineVector lv; - SVector lineStates; + SVector lineStates; void GapTo(int position); void RoomFor(int insertionLength); diff --git a/src/SVector.h b/src/SVector.h index 9a260542b..d4d49c717 100644 --- a/src/SVector.h +++ b/src/SVector.h @@ -6,13 +6,12 @@ #ifndef SVECTOR_H #define SVECTOR_H -// A simple expandable vector. -// T must support assignment. +// A simple expandable integer vector. // Storage not allocated for elements until an element is used. // This makes it very lightweight unless used so is a good match for optional features. -template + class SVector { - T *v; + int *v; unsigned int size; // Number of elements allocated unsigned int len; // Number of elements in vector bool allocFailure; // A memory allocation call has failed @@ -20,17 +19,17 @@ class SVector { // Internally allocate more elements than the user wants to avoid // thrashng the memory allocator void SizeTo(int newSize) { - if (newSize < sizeIncrement) - newSize += sizeIncrement; + if (newSize < 4000) + newSize += 4000; else newSize = (newSize * 3) / 2; - T* newv = new T[newSize]; + int* newv = new int[newSize]; if (!newv) { allocFailure = true; return; } size = newSize; - unsigned int i=0; + unsigned int i=0; for (; i= len) { if (i >= size) { SizeTo(i); -- cgit v1.2.3