pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:87:    add_ref(&empty_array);    return &empty_array;    }       /* Limits size to (1<<29)-4 */    if( (size_t)(size+extra_space-1) >    (LONG_MAX-sizeof(struct array))/sizeof(struct svalue) )    Pike_error("Too large array (size %ld exceeds %ld).\n",    (long)(size+extra_space-1),    (long)((LONG_MAX-sizeof(struct array))/sizeof(struct svalue)) ); -  v=malloc(sizeof(struct array)+ -  (size+extra_space-1)*sizeof(struct svalue)); +  v=calloc(sizeof(struct array)+ +  (size+extra_space-1)*sizeof(struct svalue), 1);    if(!v)    Pike_error(msg_out_of_mem_2, sizeof(struct array)+    (size+extra_space-1)*sizeof(struct svalue));       GC_ALLOC(v);          if (size+extra_space)    /* for now, we don't know what will go in here */    v->type_field = BIT_MIXED | BIT_UNFINISHED;    else    v->type_field = 0;    v->flags=0;       v->malloced_size = (INT32)(size + extra_space);    v->item=v->real_item;    v->size = (INT32)size;    INIT_PIKE_MEMOBJ(v, T_ARRAY);    DOUBLELINK (first_array, v);    -  { -  struct svalue *item = ITEM(v); -  struct svalue *item_end = item + v->size; -  while (item < item_end) -  *item++ = svalue_int_zero; -  } -  +     return v;   }      /**    * Free an array without freeing the values inside it.    * Any values inside of the array will be kept.    * @param v The array to be freed.    */   static void array_free_no_free(struct array *v)   {