Variable timeframe abstraction.

This commit is contained in:
Alan Mishchenko 2012-02-13 20:40:38 -08:00
parent d931de7feb
commit 59ea100dbf
1 changed files with 6 additions and 0 deletions

View File

@ -56,6 +56,12 @@ static inline void veci_push (veci* v, int e)
// int newsize = v->cap * 2;//+1;
int newsize = (v->cap < 4) ? v->cap * 2 : (v->cap / 2) * 3;
v->ptr = ABC_REALLOC( int, v->ptr, newsize );
if ( v->ptr == NULL )
{
printf( "Failed to realloc memory from %.1f Mb to %.1f Mb.\n",
1.0 * v->cap / (1<<20), 1.0 * newsize / (1<<20) );
fflush( stdout );
}
v->cap = newsize; }
v->ptr[v->size++] = e;
}