pike.git / src / mapping.c

version» Context lines:

pike.git/src/mapping.c:12:   #include "array.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "pike_memory.h"   #include "pike_types.h"   #include "dynamic_buffer.h"   #include "interpret.h"   #include "las.h"   #include "gc.h"   #include "stralloc.h" - #include "pike_security.h" +    #include "block_allocator.h"   #include "opcodes.h"   #include "stuff.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;   
pike.git/src/mapping.c:55:      void really_free_mapping(struct mapping * m) {   #ifdef PIKE_DEBUG    if (m->refs) {   # ifdef DEBUG_MALLOC    describe_something(m, T_MAPPING, 0,2,0, NULL);   # endif    Pike_fatal("really free mapping on mapping with %d refs.\n", m->refs);    }   #endif -  FREE_PROT(m); +     unlink_mapping_data(m->data);    DOUBLEUNLINK(first_mapping, m);    GC_FREE(m);    ba_free(&mapping_allocator, m);   }      ATTRIBUTE((malloc))   static struct mapping * alloc_mapping(void) {    return ba_alloc(&mapping_allocator);   }
pike.git/src/mapping.c:156: Inside #if defined(PIKE_DEBUG)
      if(val_types & ~(m->data->val_types))    Pike_fatal("Mapping value types out of order!\n");       if(ind_types & ~(m->data->ind_types))    Pike_fatal("Mapping indices types out of order!\n");   }   #endif      static struct mapping_data empty_data = -  { PIKE_CONSTANT_MEMOBJ_INIT(1, T_MAPPING_DATA), 1, 0,0,0,0,0,0, 0, +  { 1, 1, 0,0,0,0,0,0, 0,    IF_ELSE_KEYPAIR_LOOP((struct keypair *)&empty_data.hash, 0), {0}};   static struct mapping_data weak_ind_empty_data = -  { PIKE_CONSTANT_MEMOBJ_INIT(1, T_MAPPING_DATA), 1, 0,0,0,0,0,0, MAPPING_WEAK_INDICES, +  { 1, 1, 0,0,0,0,0,0, MAPPING_WEAK_INDICES,    IF_ELSE_KEYPAIR_LOOP((struct keypair *)&weak_ind_empty_data.hash, 0), {0}};   static struct mapping_data weak_val_empty_data = -  { PIKE_CONSTANT_MEMOBJ_INIT(1, T_MAPPING_DATA), 1, 0,0,0,0,0,0, MAPPING_WEAK_VALUES, +  { 1, 1, 0,0,0,0,0,0, MAPPING_WEAK_VALUES,    IF_ELSE_KEYPAIR_LOOP((struct keypair *)&weak_val_empty_data.hash, 0), {0}};   static struct mapping_data weak_both_empty_data = -  { PIKE_CONSTANT_MEMOBJ_INIT(1, T_MAPPING_DATA), 1, 0,0,0,0,0,0, MAPPING_WEAK, +  { 1, 1, 0,0,0,0,0,0, MAPPING_WEAK,    IF_ELSE_KEYPAIR_LOOP((struct keypair *)&weak_both_empty_data.hash, 0), {0}};      /** This function allocates the hash table and svalue space for a mapping    * struct. The size is the max number of indices that can fit in the    * allocated space.    */   static void init_mapping(struct mapping *m,    INT32 size,    INT16 flags)   {
pike.git/src/mapping.c:250:    * @see free_mapping    */   PMOD_EXPORT struct mapping *debug_allocate_mapping(int size)   {    struct mapping *m;       m=alloc_mapping();       GC_ALLOC(m);    -  INITIALIZE_PROT(m); +     init_mapping(m,size,0);       m->refs = 0;    add_ref(m); /* For DMALLOC... */       DOUBLELINK(first_mapping, m);       return m;   }