pike.git / src / array.c

version» Context lines:

pike.git/src/array.c:16:   #include "pike_types.h"   #include "fsort.h"   #include "builtin_functions.h"   #include "pike_memory.h"   #include "gc.h"   #include "main.h"   #include "security.h"   #include "stuff.h"   #include "bignum.h"    - RCSID("$Id: array.c,v 1.73 2000/06/09 22:43:04 mast Exp $"); + RCSID("$Id: array.c,v 1.74 2000/07/04 00:43:56 mast Exp $");      struct array empty_array=   {    1, /* Never free */   #ifdef PIKE_SECURITY    0,   #endif    &empty_array, /* Next */    &empty_array, /* previous (circular) */    0, /* Size = 0 */
pike.git/src/array.c:1777: Inside #if defined(PIKE_DEBUG)
   fatal("Null pointer in array list.\n");    } while (a != & empty_array);   }   #endif /* PIKE_DEBUG */         static void gc_check_array(struct array *a)   {    if(a->type_field & BIT_COMPLEX)    { -  TYPE_FIELD t; +     if (a->flags & ARRAY_WEAK_FLAG) -  t=debug_gc_check_weak_svalues(ITEM(a), a->size, T_ARRAY, a); +  debug_gc_check_weak_svalues(ITEM(a), a->size, T_ARRAY, a);    else -  t=debug_gc_check_svalues(ITEM(a), a->size, T_ARRAY, a); -  -  /* Ugly, but we are not allowed to change type_field -  * at the same time as the array is being built... -  * Actually we just need better primitives for building arrays. -  */ -  if(!(a->type_field & BIT_UNFINISHED) || a->refs!=1) -  a->type_field = t; -  else -  a->type_field |= t; +  debug_gc_check_svalues(ITEM(a), a->size, T_ARRAY, a);    }   }      static void gc_recurse_weak_array(struct array *a, -  TYPE_FIELD (*recurse_fn)(struct svalue *, int)) +  TYPE_FIELD (*recurse_fn)(struct svalue *, size_t))   {    int e;    TYPE_FIELD t;      #ifdef PIKE_DEBUG    if(!(a->flags & ARRAY_WEAK_FLAG))    fatal("Array is not weak.\n");   #endif       if(a->flags & ARRAY_WEAK_SHRINK) {
pike.git/src/array.c:1850:    gc_internal_array = a->next;    else {    UNLINK_ARRAY(a);    LINK_ARRAY(a); /* Linked in first. */    }       if (a->type_field & BIT_COMPLEX)    {    if (a->flags & ARRAY_WEAK_FLAG)    gc_recurse_weak_array(a, gc_mark_weak_svalues); +  else { +  TYPE_FIELD t; +  if ((t = gc_mark_svalues(ITEM(a), a->size))) { +  if(!(a->type_field & BIT_UNFINISHED) || a->refs!=1) +  a->type_field = t;    else -  gc_mark_svalues(ITEM(a), a->size); +  a->type_field |= t;    }    }    } -  +  } + }      static void low_gc_cycle_check_array(struct array *a)   {    int e;   #ifdef PIKE_DEBUG    if (a == &empty_array) fatal("Trying to gc cycle check empty_array.\n");   #endif       if (a->type_field & BIT_COMPLEX)    {    if (a->flags & ARRAY_WEAK_FLAG)    gc_recurse_weak_array(a, gc_cycle_check_weak_svalues); -  +  else { +  TYPE_FIELD t; +  if ((t = gc_cycle_check_svalues(ITEM(a), a->size))) { +  if(!(a->type_field & BIT_UNFINISHED) || a->refs!=1) +  a->type_field = t;    else -  gc_cycle_check_svalues(ITEM(a), a->size); +  a->type_field |= t;    }    } -  +  } + }      void real_gc_cycle_check_array(struct array *a)   {    GC_CYCLE_ENTER(a, 0) {    low_gc_cycle_check_array(a);    } GC_CYCLE_LEAVE;   }      void real_gc_cycle_check_array_weak(struct array *a)   {