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.194 2008/01/05 18:05:10 nilsson Exp $ + || $Id: mapping.c,v 1.195 2008/01/26 22:34:21 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:183:    m->data=md;    md->hashsize=hashsize;       MEMSET((char *)md->hash, 0, sizeof(struct keypair *) * md->hashsize);       md->free_list=MD_KEYPAIRS(md, hashsize);   #ifndef PIKE_MAPPING_KEYPAIR_LOOP    for(e=1;e<size;e++)    {    md->free_list[e-1].next = md->free_list + e; -  md->free_list[e-1].ind.type=T_INT; -  md->free_list[e-1].val.type=T_INT; +  mark_free_svalue (&md->free_list[e-1].ind); +  mark_free_svalue (&md->free_list[e-1].val);    }    md->free_list[e-1].next=0; -  md->free_list[e-1].ind.type=T_INT; -  md->free_list[e-1].val.type=T_INT; +  mark_free_svalue (&md->free_list[e-1].ind); +  mark_free_svalue (&md->free_list[e-1].val);   #endif /* !PIKE_MAPPING_KEYPAIR_LOOP */    md->ind_types = 0;    md->val_types = 0;    md->flags = flags;    md->size = 0;    md->refs=0;    md->valrefs=0;    md->hardlinks=0;    md->num_keypairs=size;    }else{
pike.git/src/mapping.c:980:    /* No need to propagate */    *prev=k->next;    free_svalue(& k->ind);    if(to)    to[0]=k->val;    else    free_svalue(& k->val);       FREE_KEYPAIR(md, k);    -  md->free_list->ind.type=T_INT; -  md->free_list->val.type=T_INT; +  mark_free_svalue (&md->free_list->ind); +  mark_free_svalue (&md->free_list->val);       md->size--;   #ifdef MAPPING_SIZE_DEBUG    if(m->data ==md)    m->debug_size--;   #endif       if(md->size < (md->hashsize + 1) * MIN_LINK_LENGTH)    {    debug_malloc_touch(m);
pike.git/src/mapping.c:1041:    if((k->ind.type == T_OBJECT || k->ind.type == T_FUNCTION) &&    !k->ind.u.object->prog)    {    debug_malloc_touch(m);    debug_malloc_touch(md);    PREPARE_FOR_INDEX_CHANGE2();    *prev=k->next;    free_svalue(& k->ind);    free_svalue(& k->val);    FREE_KEYPAIR(md, k); -  md->free_list->ind.type = T_INT; -  md->free_list->val.type = T_INT; +  mark_free_svalue (&md->free_list->ind); +  mark_free_svalue (&md->free_list->val);    md->size--;   #ifdef MAPPING_SIZE_DEBUG    if(m->data ==md)    {    m->debug_size++;    debug_malloc_touch(m);    }   #endif    debug_malloc_touch(md);    }else{
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    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)
pike.git/src/mapping.c:1939:    if (m->data->size == 1) {    my_strcat("([ /* 1 element */\n");    } else {    sprintf(buf, "([ /* %ld elements */\n", (long)m->data->size);    my_strcat(buf);    }       Pike_interpreter.trace_level = 0;    if(SETJMP(catch)) {    free_svalue(&throw_value); -  throw_value.type = T_INT; +  mark_free_svalue (&throw_value);    }    else    sort_array_destructively(a);    UNSETJMP(catch);    Pike_interpreter.trace_level = save_t_flag;       for(e = 0; e < a->size; e++)    {    struct svalue *tmp;    if(e)
pike.git/src/mapping.c:2357:    while (*prev_ != k) { \    prev_ = &((*prev_)->next); \    DO_IF_DEBUG( \    if (!*prev_) { \    Pike_fatal("Node to unlink not found!\n"); \    } \    ); \    } \    (*prev_)->next = k->next; \    FREE_KEYPAIR(MD, k); \ -  MD->free_list->ind.type = T_INT; \ -  MD->free_list->val.type = T_INT; \ +  mark_free_svalue (&MD->free_list->ind); \ +  mark_free_svalue (&MD->free_list->val); \    MD->size--; \    DO_IF_MAPPING_SIZE_DEBUG( \    if(M->data ==MD) \    M->debug_size--; \    ); \    } else { \    VAL_TYPES |= 1 << k->val.type; \    IND_TYPES |= 1 << k->ind.type; \    k++; \    } \
pike.git/src/mapping.c:2390:    { \    REC_KEYPAIR(remove, \    PIKE_CONCAT(TYPE, _svalues), \    PIKE_CONCAT(TYPE, _weak_svalues), \    PIKE_CONCAT(TYPE, _without_recurse), \    PIKE_CONCAT(TYPE, _weak_without_recurse)); \    if (remove) \    { \    *prev=k->next; \    FREE_KEYPAIR(MD, k); \ -  MD->free_list->ind.type = T_INT; \ -  MD->free_list->val.type = T_INT; \ +  mark_free_svalue (&MD->free_list->ind); \ +  mark_free_svalue (&MD->free_list->val); \    MD->size--; \    DO_IF_MAPPING_SIZE_DEBUG( \    if(M->data ==MD) \    M->debug_size--; \    ); \    }else{ \    VAL_TYPES |= 1 << k->val.type; \    IND_TYPES |= 1 << k->ind.type; \    prev=&k->next; \    } \