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.37 1998/11/22 11:03:02 hubbe Exp $"); + RCSID("$Id: mapping.c,v 1.38 1999/01/21 09:15:05 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"   #include "interpret.h"   #include "las.h"   #include "gc.h"   #include "stralloc.h" -  + #include "security.h"      #define AVG_LINK_LENGTH 4   #define MIN_LINK_LENGTH 1   #define MAP_SLOTS(X) ((X)?((X)+((X)>>4)+8):0)      struct mapping *first_mapping;         #ifdef PIKE_DEBUG   /* This function checks that the type field isn't lacking any bits.
pike.git/src/mapping.c:99:   /* This function allocates an empty mapping with room for 'size' values    */   struct mapping *allocate_mapping(int size)   {    struct mapping *m;       GC_ALLOC();       m=ALLOC_STRUCT(mapping);    +  INITIALIZE_PROT(m);    init_mapping(m,size);       m->next = first_mapping;    m->prev = 0;    m->refs = 1;       if(first_mapping) first_mapping->prev = m;    first_mapping=m;       return m;
pike.git/src/mapping.c:123:    */   void really_free_mapping(struct mapping *m)   {    INT32 e;    struct keypair *k;   #ifdef PIKE_DEBUG    if(m->refs)    fatal("really free mapping on mapping with nonzero refs.\n");   #endif    +  FREE_PROT(m); +     MAPPING_LOOP(m)    {    free_svalue(& k->val);    free_svalue(& k->ind);    }       if(m->prev)    m->prev->next = m->next;    else    first_mapping = m->next;