pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:51:    GC_ALLOC();       v=(struct array *)malloc(sizeof(struct array)+    (size+extra_space-1)*sizeof(struct svalue));    if(!v)    error("Couldn't allocate array, out of memory.\n");          /* for now, we don't know what will go in here */    v->type_field=BIT_MIXED | BIT_UNFINISHED; +  v->flags=0;       v->malloced_size=size+extra_space;    v->size=size;    v->refs=1;    v->prev=&empty_array;    v->next=empty_array.next;    empty_array.next=v;    v->next->prev=v;       for(e=0;e<v->size;e++)
pike.git/src/array.c:763:   }      /* Maybe I should have a 'clean' flag for this computation */   void array_fix_type_field(struct array *v)   {    int e;    TYPE_FIELD t;       t=0;    +  if(v->flags & ARRAY_LVALUE) +  { +  v->type_field=BIT_MIXED; +  return; +  } +     for(e=0; e<v->size; e++) t |= 1 << ITEM(v)[e].type;      #ifdef DEBUG    if(t & ~(v->type_field))    fatal("Type field out of order!\n");   #endif    v->type_field = t;   }      #ifdef DEBUG   /* Maybe I should have a 'clean' flag for this computation */   void array_check_type_field(struct array *v)   {    int e;    TYPE_FIELD t;       t=0;    -  for(e=0; e<v->size; e++) t |= 1 << ITEM(v)[e].type; +  if(v->flags & ARRAY_LVALUE) +  return;    -  +  for(e=0; e<v->size; e++) +  { +  if(ITEM(v)[e].type > MAX_TYPE) +  fatal("Type is out of range.\n"); +  +  t |= 1 << ITEM(v)[e].type; +  } +     if(t & ~(v->type_field))    fatal("Type field out of order!\n");   }   #endif      struct array *compact_array(struct array *v) { return v; }      /*    * Get a pointer to the 'union anything' specified IF it is of the specified    * type. The 'union anything' may be changed, but not the type.