pike.git / src / mapping.c

version» Context lines:

pike.git/src/mapping.c:1:   /*   || 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.197 2008/01/28 00:49:36 mast Exp $ + || $Id: mapping.c,v 1.198 2008/01/28 19:46:13 mast Exp $   */      #include "global.h"   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "pike_error.h"
pike.git/src/mapping.c:741:    free_mapping_data(md);    if(!overwrite) return;    PREPARE_FOR_DATA_CHANGE2();    PROPAGATE(); /* propagate after preparing */    md->val_types |= 1 << val->type;    if (overwrite == 2 && key->type == T_OBJECT)    /* Should replace the index too. It's only for objects that it's    * possible to tell the difference. */    assign_svalue (&k->ind, key);    assign_svalue(& k->val, val); -  if (val->type == T_INT) k->val.subtype = NUMBER_NUMBER; +    #ifdef PIKE_DEBUG    if(d_flag>1) check_mapping(m);   #endif    return;       mi_insert:   #ifdef PIKE_DEBUG    if(m->data != md)    Pike_fatal("Wrong dataset in mapping_insert!\n");    if(d_flag>1) check_mapping(m);
pike.git/src/mapping.c:783:    md->free_list=k->next;   #else /* PIKE_MAPPING_KEYPAIR_LOOP */    md->free_list++;   #endif /* !PIKE_MAPPING_KEYPAIR_LOOP */    k->next=md->hash[h];    md->hash[h]=k;    md->ind_types |= 1 << key->type;    md->val_types |= 1 << val->type;    assign_svalue_no_free(& k->ind, key);    assign_svalue_no_free(& k->val, val); -  if (val->type == T_INT) k->val.subtype = NUMBER_NUMBER; +     k->hval = h2;    md->size++;   #ifdef MAPPING_SIZE_DEBUG    if(m->data ==md)    m->debug_size++;   #endif      #ifdef PIKE_DEBUG    if(d_flag>1) check_mapping(m);   #endif
pike.git/src/mapping.c:1209:         PMOD_EXPORT void mapping_index_no_free(struct svalue *dest,    struct mapping *m,    const struct svalue *key)   {    struct svalue *p;       if(!IS_DESTRUCTED (key) && (p=low_mapping_lookup(m,key)))    { - #if 0 +  assign_svalue_no_free(dest, p); +     /* Never return NUMBER_UNDEFINED for existing entries. */ -  /* No, but UNDEFINED values are reasonably not stored in the first -  * place. (Or it's at least more efficient to take care of that -  * when they're stored.) /mast */ +  /* Note: There is code that counts on storing UNDEFINED in mapping +  * values (using e.g. low_mapping_lookup to get them), so we have +  * to fix the subtype here rather than in mapping_insert. */    if(p->type==T_INT) -  p->subtype=NUMBER_NUMBER; - #endif -  -  assign_svalue_no_free(dest, p); +  dest->subtype=NUMBER_NUMBER;    }else{    dest->type=T_INT;    dest->u.integer=0;    dest->subtype=NUMBER_UNDEFINED;    }   }      PMOD_EXPORT struct array *mapping_indices(struct mapping *m)   {    INT32 e;