Changes in src/tests/vector/vector_int.c [cdbfab0:9a4e996]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/tests/vector/vector_int.c
rcdbfab0 r9a4e996 27 27 vec.last = -1; 28 28 vec.capacity = reserve; 29 vec.data = (int *)malloc( sizeof( int ) * reserve );29 vec.data = malloc( sizeof( int ) * reserve ); 30 30 } 31 31 … … 33 33 vec.last = other.last; 34 34 vec.capacity = other.capacity; 35 vec.data = (int *)malloc( sizeof( int ) * other.capacity );35 vec.data = malloc( sizeof( int ) * other.capacity ); 36 36 for (int i = 0; i < vec.last; i++) { 37 37 vec.data[i] = other.data[i]; … … 45 45 void reserve( vector_int *vec, int reserve ) { 46 46 if ( reserve > vec->capacity ) { 47 vec->data = (int *)realloc( vec->data, sizeof( int ) * reserve );47 vec->data = realloc( vec->data, sizeof( int ) * reserve ); 48 48 vec->capacity = reserve; 49 49 } … … 54 54 if ( vec->last == vec->capacity ) { 55 55 vec->capacity *= 2; 56 vec->data = (int *)realloc( vec->data, sizeof( int ) * vec->capacity );56 vec->data = realloc( vec->data, sizeof( int ) * vec->capacity ); 57 57 } 58 58 vec->data[ vec->last ] = element;
Note: See TracChangeset
for help on using the changeset viewer.