Fix the "array" test

This commit is contained in:
Pierre Pronchery 2015-06-15 01:11:26 -04:00
parent 138570c9bc
commit b9405984f9

View File

@ -88,13 +88,12 @@ int array_get_copy(Array * array, size_t pos, void * value)
/* array_set */ /* array_set */
int array_set(Array * array, size_t pos, void * value) int array_set(Array * array, size_t pos, void * value)
/* FIXME not tested */
{ {
void * p; void * p;
size_t cursize; size_t cursize;
size_t newpos; size_t newpos;
newpos = array->count * (pos); newpos = pos * array->size;
if(array->count <= pos) if(array->count <= pos)
{ {
if((p = realloc(array->value, array->size * (pos + 1))) == NULL) if((p = realloc(array->value, array->size * (pos + 1))) == NULL)