pike.git / src / mapping.c

version» Context lines:

pike.git/src/mapping.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   /**/   #include "global.h" - RCSID("$Id: mapping.c,v 1.91 2000/07/06 23:25:26 mast Exp $"); + RCSID("$Id: mapping.c,v 1.92 2000/07/11 03:45:10 mast Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "error.h"   #include "pike_memory.h"   #include "dynamic_buffer.h"   #include "interpret.h"
pike.git/src/mapping.c:839:    INT32 e;    struct keypair *k, **prev;    TYPE_FIELD ind_types, val_types;    struct mapping_data *md=m->data;      #ifdef PIKE_DEBUG    if(m->data->refs <=0)    fatal("Zero refs in mapping->data\n");    if(d_flag>1) check_mapping(m);    debug_malloc_touch(m); -  if (Pike_in_gc > GC_PASS_PREPARE && Pike_in_gc != GC_PASS_MARK) +  if (Pike_in_gc > GC_PASS_PREPARE && Pike_in_gc < GC_PASS_FREE && +  Pike_in_gc != GC_PASS_MARK)    fatal("check_mapping_for_destruct called in wrong pass inside gc.\n");   #endif       /* no is_eq -> no locking */       if(!md->size) return;       if((md->ind_types | md->val_types) & (BIT_OBJECT | BIT_FUNCTION))    {    val_types = ind_types = 0;
pike.git/src/mapping.c:2053:    }   }      void gc_free_all_unreferenced_mappings(void)   {    INT32 e;    struct keypair *k,**prev;    struct mapping *m,*next;    struct mapping_data *md;    +  if (gc_ext_weak_refs) { +  /* Have to go through all marked things if we got external weak +  * references to otherwise unreferenced things, so the mark +  * functions can free those references. */ +  gc_mark_mapping_pos = first_mapping; +  while (gc_mark_mapping_pos != gc_internal_mapping && gc_ext_weak_refs) { +  struct mapping *m = gc_mark_mapping_pos; +  gc_mark_mapping_pos = m->next; +  gc_mark_mapping_as_referenced(m); +  } +  discard_queue(&gc_mark_queue); +  } +     for(m=gc_internal_mapping;m;m=next)    {    if(gc_do_free(m))    {    /* Got an extra ref from gc_cycle_pop(). */    md = m->data;    /* Protect against unlink_mapping_data() recursing too far. */    m->data=&empty_data;    m->data->refs++;