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.196 2008/01/27 14:41:10 grubba Exp $ + || $Id: mapping.c,v 1.197 2008/01/28 00:49:36 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:782:    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:974: Inside #if defined(PIKE_DEBUG)
   Pike_fatal("Wrong dataset in mapping_delete!\n");    if(d_flag>1) check_mapping(m);    debug_malloc_touch(m);   #endif    free_mapping_data(md);    PREPARE_FOR_INDEX_CHANGE2();    /* No need to propagate */    *prev=k->next;    free_svalue(& k->ind);    if(to) -  to[0]=k->val; +  move_svalue (to, &k->val);    else    free_svalue(& k->val);       FREE_KEYPAIR(md, k);       mark_free_svalue (&md->free_list->ind);    mark_free_svalue (&md->free_list->val);       md->size--;   #ifdef MAPPING_SIZE_DEBUG
pike.git/src/mapping.c:1207:         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    /* 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 */    if(p->type==T_INT)    p->subtype=NUMBER_NUMBER; -  + #endif       assign_svalue_no_free(dest, p);    }else{    dest->type=T_INT;    dest->u.integer=0;    dest->subtype=NUMBER_UNDEFINED;    }   }      PMOD_EXPORT struct array *mapping_indices(struct mapping *m)