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.43 1999/10/29 00:07:19 hubbe Exp $"); + RCSID("$Id: mapping.c,v 1.44 1999/10/29 03:34:34 mast Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "language.h"   #include "error.h"   #include "pike_memory.h"   #include "dynamic_buffer.h"
pike.git/src/mapping.c:1058: Inside #if defined(PIKE_DEBUG)
   check_mapping(m);   }   #endif         void gc_mark_mapping_as_referenced(struct mapping *m)   {    INT32 e;    struct keypair *k;    -  if(gc_mark(m) && !( m->flags & MAPPING_FLAG_WEAK)) +  if(gc_mark(m))    {    if((m->ind_types | m->val_types) & BIT_COMPLEX)    {    MAPPING_LOOP(m)    {    /* We do not want to count this key:index pair if    * the index is a destructed object or function    */    if(((1 << k->ind.type) & (BIT_OBJECT | BIT_FUNCTION)) &&    !(k->ind.u.object->prog))    continue;    -  +  if (m->flags & MAPPING_FLAG_WEAK) +  { +  if (k->ind.type == T_OBJECT && +  k->ind.u.object->prog->flags & PROGRAM_NO_WEAK_DESTRUCT)    gc_mark_svalues(&k->ind, 1); -  +  if (k->val.type == T_OBJECT && k->val.u.object->prog && +  k->val.u.object->prog->flags & PROGRAM_NO_WEAK_DESTRUCT)    gc_mark_svalues(&k->val, 1);    } -  +  else { +  gc_mark_svalues(&k->ind, 1); +  gc_mark_svalues(&k->val, 1);    }    }    } -  +  } + }      void gc_check_all_mappings(void)   {    INT32 e;    struct keypair *k;    struct mapping *m;       for(m=first_mapping;m;m=m->next)    {    if((m->ind_types | m->val_types) & BIT_COMPLEX)
pike.git/src/mapping.c:1162:       free_mapping(m);    }    else if(m->flags & MAPPING_FLAG_WEAK)    {    add_ref(m);    for(e=0;e<m->hashsize;e++)    {    for(prev= m->hash + e;(k=*prev);)    { -  if((k->val.type <= MAX_COMPLEX && gc_do_free(k->val.u.refs)) || -  (k->ind.type <= MAX_COMPLEX && gc_do_free(k->ind.u.refs))) +  if((k->val.type <= MAX_COMPLEX && +  !(k->val.type == T_OBJECT && k->val.u.object->prog && +  k->val.u.object->prog->flags & PROGRAM_NO_WEAK_DESTRUCT) && +  gc_do_free(k->val.u.refs)) || +  (k->ind.type <= MAX_COMPLEX && +  !(k->ind.type == T_OBJECT && k->ind.u.object->prog && +  k->ind.u.object->prog->flags & PROGRAM_NO_WEAK_DESTRUCT) && +  gc_do_free(k->ind.u.refs)))    {    *prev=k->next;    free_svalue(& k->ind);    free_svalue(& k->val);    k->next=m->free_list;    m->free_list=k;    m->size--;    }else{    prev=&k->next;    }