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.74 2000/04/15 09:34:02 hubbe Exp $"); + RCSID("$Id: mapping.c,v 1.75 2000/04/16 22:11:34 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:851:    md->val_types |= BIT_INT;    for(e=0;e<md->hashsize;e++)    {    for(prev= md->hash + e;(k=*prev);)    {    check_destructed(& k->val);       if((k->ind.type == T_OBJECT || k->ind.type == T_FUNCTION) &&    !k->ind.u.object->prog)    { +  debug_malloc_touch(md); +  debug_malloc_touch(m);    PREPARE_FOR_INDEX_CHANGE2();    *prev=k->next;    free_svalue(& k->ind);    free_svalue(& k->val);    k->next=md->free_list;    md->free_list=k;    md->size--;   #ifdef PIKE_DEBUG    if(m->data ==md) -  +  {    m->debug_size++; -  +  debug_malloc_touch(m); +  }   #endif -  +  debug_malloc_touch(md);    }else{    val_types |= 1 << k->val.type;    ind_types |= 1 << k->ind.type;    prev=&k->next;    }    }    }    if(MAP_SLOTS(md->size) < md->hashsize * MIN_LINK_LENGTH)    {    debug_malloc_touch(m);
pike.git/src/mapping.c:1689:   }         #ifdef PIKE_DEBUG      void check_mapping(struct mapping *m)   {    int e,num;    struct keypair *k;    struct mapping_data *md; +  +  static int in_check_mapping; +  if(in_check_mapping) return; +  in_check_mapping=1; +     md=m->data;       if(m->refs <=0)    fatal("Mapping has zero refs.\n");       if(!m->data)    fatal("Mapping has no data block.\n");       if (!m->data->refs)    fatal("Mapping data block has zero refs.\n");       if(m->next && m->next->prev != m)    fatal("Mapping ->next->prev != mapping.\n");       if(m->debug_size != md->size)    { -  fprintf(stderr,"--MAPPING ZAPPING, mapping:\n"); +  fprintf(stderr,"--MAPPING ZAPPING (%d!=%d), mapping:\n",m->debug_size,md->size);    describe(m); -  fprintf(stderr,"--MAPPING ZAPPING, mapping data:\n"); +  fprintf(stderr,"--MAPPING ZAPPING (%d!=%d), mapping data:\n",m->debug_size,md->size);    describe(md);    fatal("Mapping zapping detected (%d != %d)!\n",m->debug_size,md->size);    }       if(m->prev)    {    if(m->prev->next != m)    fatal("Mapping ->prev->next != mapping.\n");    }else{    if(first_mapping != m)
pike.git/src/mapping.c:1776: Inside #if defined(PIKE_DEBUG)
   check_svalue(& k->val);       /* FIXME add check for k->hval    * beware that hash_svalue may be threaded and locking    * is required!!    */    }       if(md->size != num)    fatal("Shields are failing, hull integrity down to 20%%\n"); +  +  in_check_mapping=0;   }      void check_all_mappings(void)   {    struct mapping *m;    for(m=first_mapping;m;m=m->next)    check_mapping(m);   }   #endif