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.104 2000/09/14 15:23:41 mast Exp $"); + RCSID("$Id: mapping.c,v 1.105 2000/09/14 19:58:43 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:60:    unlink_mapping_data(m->data); \    \    if (gc_internal_mapping) { \    if (m == gc_internal_mapping) \    gc_internal_mapping = m->next; \    if (m == gc_mark_mapping_pos) \    gc_mark_mapping_pos = m->next; \    } \    DOUBLEUNLINK(first_mapping, m); \    \ -  GC_FREE(); +  GC_FREE(m);         #undef COUNT_OTHER      #define COUNT_OTHER() do{ \    struct mapping *m; \    for(m=first_mapping;m;m=m->next) \    { \    num++; \    size+=MAPPING_DATA_SIZE(m->data->hashsize, m->data->num_keypairs); \
pike.git/src/mapping.c:192:   }         PMOD_EXPORT void really_free_mapping_data(struct mapping_data *md)   {    INT32 e;    struct keypair *k;    debug_malloc_touch(md);      #ifdef PIKE_DEBUG -  if (Pike_in_gc > GC_PASS_PREPARE && Pike_in_gc < GC_PASS_ZAP_WEAK) -  fatal("Can't free a mapping_data inside gc.\n"); -  +     if (md->refs) {    fatal("really_free_mapping_data(): md has non-zero refs: %d\n",    md->refs);    }   #endif /* PIKE_DEBUG */       NEW_MAPPING_LOOP(md)    {    free_svalue(& k->val);    free_svalue(& k->ind);    }       free((char *) md); -  +  GC_FREE_BLOCK(md);   }      PMOD_EXPORT void do_free_mapping(struct mapping *m)   {    if (m)    free_mapping(m);   }      /* This function is used to rehash a mapping without loosing the internal    * order in each hash chain. This is to prevent mappings from becoming
pike.git/src/mapping.c:304:    INT32 tmp=m->data->size;   #endif    INT32 e;       md=m->data;    debug_malloc_touch(md);   #ifdef PIKE_DEBUG    if(md->refs <=0)    fatal("Zero refs in mapping->data\n");    -  if (Pike_in_gc > GC_PASS_PREPARE && Pike_in_gc < GC_PASS_ZAP_WEAK) -  fatal("Can't rehash a mapping inside gc.\n"); -  +     if(d_flag>1) check_mapping(m);   #endif       init_mapping(m, new_size);    debug_malloc_touch(m);    new_md=m->data;    new_md->flags = md->flags;       /* This operation is now 100% atomic - no locking required */    if(md->refs>1)
pike.git/src/mapping.c:329:    for(e=0;e<md->hashsize;e++)    mapping_rehash_backwards_good(new_md, md->hash[e]);       unlink_mapping_data(md);    }else{    /* evil */    for(e=0;e<md->hashsize;e++)    mapping_rehash_backwards_evil(new_md, md->hash[e]);       free((char *)md); +  GC_FREE_BLOCK(md);    }      #ifdef PIKE_DEBUG    if(m->data->size != tmp)    fatal("Rehash failed, size not same any more.\n");   #endif   #ifdef MAPPING_SIZE_DEBUG    m->debug_size = m->data->size;   #endif