pike.git / src / mapping.c

version» Context lines:

pike.git/src/mapping.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: mapping.c,v 1.159 2003/01/10 12:49:03 grubba Exp $ + || $Id: mapping.c,v 1.160 2003/01/11 00:01:20 mast Exp $   */      #include "global.h" - RCSID("$Id: mapping.c,v 1.159 2003/01/10 12:49:03 grubba Exp $"); + RCSID("$Id: mapping.c,v 1.160 2003/01/11 00:01:20 mast Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "pike_memory.h"   #include "dynamic_buffer.h"   #include "interpret.h"
pike.git/src/mapping.c:2385:   {    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);   }    - void gc_free_all_unreferenced_mappings(void) + size_t gc_free_all_unreferenced_mappings(void)   {    struct mapping *m,*next;    struct mapping_data *md; -  +  size_t freed = 0;       for(m=gc_internal_mapping;m;m=next)    {    debug_malloc_touch(m);    debug_malloc_touch(m->data);       if(gc_do_free(m))    {    /* Got an extra ref from gc_cycle_pop(). */    md = m->data;
pike.git/src/mapping.c:2413:    /* Protect against unlink_mapping_data() recursing too far. */    m->data=&empty_data;    add_ref(m->data);       unlink_mapping_data(md);   #ifdef MAPPING_SIZE_DEBUG    m->debug_size=0;   #endif    gc_free_extra_ref(m);    SET_NEXT_AND_FREE(m, free_mapping); +  freed++;    }    else    {    next=m->next;    }    } -  +  +  return freed;   }      #ifdef PIKE_DEBUG      void simple_describe_mapping(struct mapping *m)   {    char *s;    init_buf();    describe_mapping(m,0,2);    s=simple_free_buf();