--- parser3/src/main/Attic/pa_array.C 2001/03/29 17:11:41 1.30 +++ parser3/src/main/Attic/pa_array.C 2001/05/17 19:33:33 1.35 @@ -5,11 +5,9 @@ Author: Alexander Petrosyan (http://design.ru/paf) - $Id: pa_array.C,v 1.30 2001/03/29 17:11:41 paf Exp $ + $Id: pa_array.C,v 1.35 2001/05/17 19:33:33 parser Exp $ */ -#include "pa_config_includes.h" - #include "pa_pool.h" #include "pa_array.h" #include "pa_exception.h" @@ -17,7 +15,7 @@ Array::Array(Pool& apool, int initial_rows) : Pooled(apool) { - initial_rows=min(3, initial_rows); + initial_rows=max(initial_rows, CR_INITIAL_ROWS_DEFAULT); head=tail=static_cast( malloc(sizeof(int)+sizeof(Chunk::Row)*initial_rows+sizeof(Chunk *))); @@ -32,9 +30,6 @@ Array::Array(Pool& apool, int initial_ro } void Array::expand(int chunk_rows) { - if(chunk_rows( malloc(sizeof(int)+sizeof(Chunk::Row)*chunk_rows+sizeof(Chunk *))); chunk->count=chunk_rows; @@ -47,7 +42,7 @@ void Array::expand(int chunk_rows) { Array& Array::operator += (Item *src) { if(chunk_is_full()) - expand(tail->count*CR_GROW_PERCENT/100); + expand(tail->count+CR_GROW_COUNT); append_here->item=src; append_here++; fused_rows++; @@ -59,7 +54,7 @@ Array::Item *Array::get(int index) const if(!(index>=0 && index=0 && indexrows; row!=append_here; row++) + (*func)(row->item, info); + break; + } else { + int count=chunk->count; + for(int i=0; irows[i].item, info); + chunk=chunk->rows[count].link; + } + } +} +*/ Array::Item* Array::first_that(First_that_func_const func, const void *info) const { Chunk *chunk=head; while(true) {