pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:255:      /*    * resize array, resize an array destructively    */   static struct array *resize_array(struct array *a, INT32 size)   {    if(a->size == size) return a;    if(size > a->size)    {    /* We should grow the array */ +     if(a->malloced_size >= size)    {    for(;a->size < size; a->size++)    {    ITEM(a)[a->size].type=T_INT;    ITEM(a)[a->size].subtype=NUMBER_NUMBER;    ITEM(a)[a->size].u.integer=0;    }    a->type_field |= BIT_INT;    return a;    }else{    struct array *ret; -  ret=allocate_array_no_init(size, (size>>3)+1); +  ret=low_allocate_array(size, (size>>3)+1);    MEMCPY(ITEM(ret),ITEM(a),sizeof(struct svalue)*a->size);    ret->type_field = a->type_field | BIT_INT;    a->size=0;    free_array(a);    return ret;    }    }else{    /* We should shrink the array */    free_svalues(ITEM(a)+size, a->size - size, a->type_field);    a->size = size;