Branch: Tag:

2007-10-03

2007-10-03 16:18:51 by Henrik Grubbström (Grubba) <grubba@grubba.org>

{weak_{ind,val,both}_,}empty_data now have a properly initialized free_list.
Fixes some issues with KEYPAIR_LOOP.

Rev: src/mapping.c:1.191

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: mapping.c,v 1.190 2007/03/09 12:01:57 mast Exp $ + || $Id: mapping.c,v 1.191 2007/10/03 16:18:51 grubba Exp $   */      #include "global.h"
93:    prev_ = md->hash + h_; \    DO_IF_DEBUG( \    if (!*prev_) { \ -  Pike_fatal("Node to move not found!\n"); \ +  Pike_fatal("Node to move not found!\n"); \    } \    ); \    while (*prev_ != md->free_list) { \    prev_ = &((*prev_)->next); \    DO_IF_DEBUG( \    if (!*prev_) { \ -  Pike_fatal("Node to move not found!\n"); \ +  Pike_fatal("Node to move not found!\n"); \    } \    ); \    } \
139:   #endif      static struct mapping_data empty_data = -  { PIKE_CONSTANT_MEMOBJ_INIT(1), 1, 0,0,0,0,0,0, 0, 0,{0}}; +  { PIKE_CONSTANT_MEMOBJ_INIT(1), 1, 0,0,0,0,0,0, 0, +  (struct keypair *)&empty_data.hash, {0}};   static struct mapping_data weak_ind_empty_data = -  { PIKE_CONSTANT_MEMOBJ_INIT(1), 1, 0,0,0,0,0,0, MAPPING_WEAK_INDICES, 0,{0}}; +  { PIKE_CONSTANT_MEMOBJ_INIT(1), 1, 0,0,0,0,0,0, MAPPING_WEAK_INDICES, +  (struct keypair *)&weak_ind_empty_data.hash, {0}};   static struct mapping_data weak_val_empty_data = -  { PIKE_CONSTANT_MEMOBJ_INIT(1), 1, 0,0,0,0,0,0, MAPPING_WEAK_VALUES, 0,{0}}; +  { PIKE_CONSTANT_MEMOBJ_INIT(1), 1, 0,0,0,0,0,0, MAPPING_WEAK_VALUES, +  (struct keypair *)&weak_val_empty_data.hash, {0}};   static struct mapping_data weak_both_empty_data = -  { PIKE_CONSTANT_MEMOBJ_INIT(1), 1, 0,0,0,0,0,0, MAPPING_WEAK, 0,{0}}; +  { PIKE_CONSTANT_MEMOBJ_INIT(1), 1, 0,0,0,0,0,0, MAPPING_WEAK, +  (struct keypair *)&weak_both_empty_data.hash, {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
1139:    return 0;   }    + /* Lookup in a mapping of mappings */   PMOD_EXPORT struct svalue *mapping_mapping_lookup(struct mapping *m,    struct svalue *key1,    struct svalue *key2,