pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:98:    * Free an array, call this when the array has zero references    */   void really_free_array(struct array *v)   {      #ifdef DEBUG    if(v == & empty_array)    fatal("Tried to free the empty_array.\n");   #endif    + #ifdef DEBUG +  if(d_flag > 1) array_check_type_field(v); + #endif +  +  v->refs++;    free_svalues(ITEM(v), v->size, v->type_field); -  +  v->refs--;    array_free_no_free(v);   }      /*    * Extract an svalue from an array    */   void array_index_no_free(struct svalue *s,struct array *v,INT32 index)   {   #ifdef DEBUG    if(index<0 || index>=v->size)
pike.git/src/array.c:1414: Inside #if defined(GC2) and #if defined(DEBUG)
  #ifdef DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif    if(a->type_field & BIT_COMPLEX)    {    TYPE_FIELD t;    t=gc_check_svalues(ITEM(a), a->size);       /* Ugly, but we are not allowed to change type_field    * at the same time as the array is being built... +  * Actually we just need beter primitives for building arrays.    */    if(!(a->type_field & BIT_UNFINISHED) || a->refs!=1)    a->type_field = t; -  +  else +  a->type_field |= t;    }       a=a->next;    } while (a != & empty_array);   }         void gc_mark_all_arrays()   {    struct array *a;
pike.git/src/array.c:1465: Inside #if defined(GC2)
   a=next;    }else{    a=a->next;    }    } while (a != & empty_array);   }         #endif /* GC2 */    + #ifdef DEBUG +  + void debug_dump_type_field(TYPE_FIELD t) + { +  int e; +  for(e=0;e<MAX_TYPE;e++) +  if(t & (1<<e)) +  fprintf(stderr," %s",get_name_of_type(e)); +  +  for(;e<16;e++) +  if(t & (1<<e)) +  fprintf(stderr," <%d>",e); + } +  + void debug_dump_array(struct array *a) + { +  fprintf(stderr,"Refs=%d, next=%p, prev=%p, size=%d, malloced_size=%d\n", +  a->refs, +  a->next, +  a->prev, +  a->size, +  a->malloced_size); +  fprintf(stderr,"Type field = "); +  debug_dump_type_field(a->type_field); +  fprintf(stderr,"\n"); +  simple_describe_array(a); + } + #endif