pike.git / src / mapping.c

version» Context lines:

pike.git/src/mapping.c:420:       md=m->data;    debug_malloc_touch(md);   #ifdef PIKE_DEBUG    if(md->refs <=0)    Pike_fatal("Zero refs in mapping->data\n");       if(d_flag>1) check_mapping(m);   #endif    -  if (md->hashsize == new_size) return m; +  /* FIXME: The special case below seems suspect. +  * /grubba 2011-09-04 +  */ +  if ((md->hashsize == new_size) && (md->refs == 1)) return m;       init_mapping(m, new_size, md->flags);    debug_malloc_touch(m);    new_md=m->data;       /* This operation is now 100% atomic - no locking required */    if(md->refs>1)    {    /* good */    for(e=0;e<md->hashsize;e++)
pike.git/src/mapping.c:2348: Inside #if defined(PIKE_DEBUG)
      if(md->size < 0)    Pike_fatal("Core breach, evacuate ship!\n");       if(md->num_keypairs < 0)    Pike_fatal("Starboard necell on fire!\n");       if(md->size > md->num_keypairs)    Pike_fatal("Pretty mean hashtable there buster!\n");    +  if(md->hashsize & (md->hashsize - 1)) +  Pike_fatal("Invalid hashtable size: 0x%08lx\n", (long)md->hashsize); +     if(md->hashsize > md->num_keypairs)    Pike_fatal("Pretty mean hashtable there buster %d > %d (2)!\n",md->hashsize,md->num_keypairs);       if(md->num_keypairs > (md->hashsize + 3) * AVG_LINK_LENGTH)    Pike_fatal("Mapping from hell detected, attempting to send it back...\n");       if(md->size > 0 && (!md->ind_types || !md->val_types))    Pike_fatal("Mapping type fields are... wrong.\n");       num=0;