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.44 1999/10/29 03:34:34 mast Exp $"); + RCSID("$Id: mapping.c,v 1.45 1999/10/30 06:13:19 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:70:    if(size < 0) fatal("init_mapping with negative value.\n");   #endif    if(size)    {    hashsize=size / AVG_LINK_LENGTH + 1;    if(!(hashsize & 1)) hashsize++;    hashspace=hashsize+1;    e=sizeof(struct keypair)*size+ sizeof(struct keypair *)*hashspace;    tmp=(char *)xalloc(e);    -  m->flags=0; +     m->hash=(struct keypair **) tmp;    m->hashsize=hashsize;       tmp+=sizeof(struct keypair *)*hashspace;       MEMSET((char *)m->hash, 0, sizeof(struct keypair *) * m->hashsize);       m->free_list=(struct keypair *) tmp;    for(e=1;e<size;e++)    m->free_list[e-1].next = m->free_list + e;
pike.git/src/mapping.c:108:    GC_ALLOC();       m=ALLOC_STRUCT(mapping);       INITIALIZE_PROT(m);    init_mapping(m,size);       m->next = first_mapping;    m->prev = 0;    m->refs = 1; +  m->flags = 0;       if(first_mapping) first_mapping->prev = m;    first_mapping=m;       return m;   }      /* This function should only be called by the free_mapping() macro.    * It frees the storate used by the mapping.    */
pike.git/src/mapping.c:1174:    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 && -  !(k->val.type == T_OBJECT && k->val.u.object->prog && +  !(k->val.type == T_OBJECT &&    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.type == T_OBJECT &&    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{