pike.git / src / mapping.c

version» Context lines:

pike.git/src/mapping.c:232:    default: md = &weak_both_empty_data; break;    }    }    add_ref(md);    m->data=md;   #ifdef MAPPING_SIZE_DEBUG    m->debug_size = md->size;   #endif   }    + static struct mapping *allocate_mapping_no_init(int size) + { +  struct mapping *m=alloc_mapping(); +  GC_ALLOC(m); +  m->refs = 0; +  add_ref(m); /* For DMALLOC... */ +  DOUBLELINK(first_mapping, m); +  return m; + } +    /** This function allocates an empty mapping with initial room    * for 'size' values.    *    * @param size initial number of values    * @return the newly allocated mapping    * @see do_free_mapping    * @see free_mapping    */   PMOD_EXPORT struct mapping *debug_allocate_mapping(int size)   { -  struct mapping *m; -  -  m=alloc_mapping(); -  -  GC_ALLOC(m); -  +  struct mapping *m = allocate_mapping_no_init(size);    init_mapping(m,size,0); -  -  m->refs = 0; -  add_ref(m); /* For DMALLOC... */ -  -  DOUBLELINK(first_mapping, m); -  +     return m;   }    -  +    PMOD_EXPORT void really_free_mapping_data(struct mapping_data *md)   {    INT32 e;    struct keypair *k;    debug_malloc_touch(md);      #ifdef PIKE_DEBUG    if (md->refs) {    Pike_fatal("really_free_mapping_data(): md has non-zero refs: %d\n",    md->refs);
pike.git/src/mapping.c:1550:   /* deferred mapping copy! */   PMOD_EXPORT struct mapping *copy_mapping(struct mapping *m)   {    struct mapping *n;      #ifdef PIKE_DEBUG    if(m->data->refs <=0)    Pike_fatal("Zero refs in mapping->data\n");   #endif    -  n=allocate_mapping(0); -  debug_malloc_touch(n->data); -  free_mapping_data(n->data); +  n=allocate_mapping_no_init(0);    n->data=m->data;   #ifdef MAPPING_SIZE_DEBUG    n->debug_size=n->data->size;   #endif    add_ref(n->data);    n->data->valrefs++;    n->data->hardlinks++;    debug_malloc_touch(n->data);    return n;   }