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.67 2000/04/20 02:41:44 hubbe Exp $"); + RCSID("$Id: array.c,v 1.68 2000/04/23 03:01:25 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:50:   {    struct array *v;    INT32 e;       if(size == 0)    {    add_ref(&empty_array);    return &empty_array;    }    -  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");    -  +  GC_ALLOC(v);    -  +     /* 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;
pike.git/src/array.c:97:    struct array *next,*prev;       next = v->next;    prev = v->prev;       v->prev->next=next;    v->next->prev=prev;       free((char *)v);    -  GC_FREE(v); +  GC_FREE();   }      /*    * Free an array, call this when the array has zero references    */   void really_free_array(struct array *v)   {   #ifdef PIKE_DEBUG    if(v == & empty_array)    fatal("Tried to free the empty_array.\n");
pike.git/src/array.c:1810:    * 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;    }   }    + #ifdef PIKE_DEBUG + INT32 gc_touch_all_arrays(void) + { +  INT32 n = 0; +  struct array *a = &empty_array; +  do { +  debug_gc_touch(a); +  n++; +  a=a->next; +  } while (a != &empty_array); +  return n; + } + #endif +    void gc_check_all_arrays(void)   {    struct array *a;    a=&empty_array;    do    {   #ifdef PIKE_DEBUG    if(d_flag > 1) array_check_type_field(a);   #endif    gc_check_array(a);