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.71 2000/04/06 20:17:05 hubbe Exp $"); + RCSID("$Id: mapping.c,v 1.72 2000/04/12 18:40:12 hubbe 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:1818:    }    else {    gc_mark_svalues(&k->ind, 1);    gc_mark_svalues(&k->val, 1);    }    }    }    }   }    - void gc_check_all_mappings(void) + static void gc_check_mapping(struct mapping *m)   {    INT32 e;    struct keypair *k; -  struct mapping *m; +     -  for(m=first_mapping;m;m=m->next) -  { - #ifdef DEBUG_MALLOC -  if (((int)m->data) == 0x55555555) { -  fprintf(stderr, "** Zapped mapping in list of active mappings!\n"); -  describe_something(m, T_MAPPING, 1); -  fatal("Zapped mapping in list of active mappings!\n"); -  } - #endif /* DEBUG_MALLOC */ +     if((m->data->ind_types | m->data->val_types) & BIT_COMPLEX)    { -  if(gc_check(m->data)) continue; +  if(gc_check(m->data)) return;       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;       debug_gc_check_svalues(&k->ind, 1, T_MAPPING, m);    m->data->val_types |= debug_gc_check_svalues(&k->val, 1, T_MAPPING, m);    } -  +  } + }    -  + void gc_check_all_mappings(void) + { +  struct mapping *m; +  +  for(m=first_mapping;m;m=m->next) +  { + #ifdef DEBUG_MALLOC +  if (((int)m->data) == 0x55555555) { +  fprintf(stderr, "** Zapped mapping in list of active mappings!\n"); +  describe_something(m, T_MAPPING, 1); +  fatal("Zapped mapping in list of active mappings!\n"); +  } + #endif /* DEBUG_MALLOC */ +  +  gc_check_mapping(m);   #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif -  +     }   } - } +       void gc_mark_all_mappings(void)   {    struct mapping *m;    for(m=first_mapping;m;m=m->next)    if(gc_is_referenced(m))    gc_mark_mapping_as_referenced(m);   }      void gc_free_all_unreferenced_mappings(void)
pike.git/src/mapping.c:1934:    }    if(MAP_SLOTS(md->size) < md->hashsize * MIN_LINK_LENGTH)    {    debug_malloc_touch(m);    rehash(m, MAP_SLOTS(md->size));    }    SET_NEXT_AND_FREE(m, free_mapping);    }    else    { + #ifdef PIKE_DEBUG +  if(d_flag) gc_check_mapping(m); + #endif    next=m->next;    }    }   }      #ifdef PIKE_DEBUG      void simple_describe_mapping(struct mapping *m)   {    char *s;