pike.git / src / mapping.c

version» Context lines:

pike.git/src/mapping.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: mapping.c,v 1.16 1997/03/17 03:04:41 hubbe Exp $"); + RCSID("$Id: mapping.c,v 1.17 1997/04/16 03:09:13 hubbe Exp $");   #include "main.h"   #include "types.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "language.h"   #include "error.h"   #include "memory.h"
pike.git/src/mapping.c:259:    h2=hash_svalue(key);    if(m->hashsize)    {    h=h2 % m->hashsize;      #ifdef DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif    if(m->ind_types & (1 << key->type))    { -  for(prev= m->hash + h;k=*prev;prev=&k->next) +  for(prev= m->hash + h;(k=*prev);prev=&k->next)    {    if(is_eq(& k->ind, key))    {    *prev=k->next;    k->next=m->hash[h];    m->hash[h]=k;       m->val_types |= 1 << val->type;    assign_svalue(& k->val, val);   
pike.git/src/mapping.c:319:    h2=hash_svalue(key);       if(m->hashsize)    {    h=h2 % m->hashsize;      #ifdef DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif    -  for(prev= m->hash + h;k=*prev;prev=&k->next) +  for(prev= m->hash + h;(k=*prev);prev=&k->next)    {    if(is_eq(& k->ind, key))    {    *prev=k->next;    k->next=m->hash[h];    m->hash[h]=k;       if(k->val.type == t) return & ( k->val.u );      #ifdef DEBUG
pike.git/src/mapping.c:377:   void map_delete(struct mapping *m,    struct svalue *key)   {    unsigned INT32 h;    struct keypair *k, **prev;       if(!m->size) return;       h=hash_svalue(key) % m->hashsize;    -  for(prev= m->hash + h;k=*prev;prev=&k->next) +  for(prev= m->hash + h;(k=*prev);prev=&k->next)    {    if(is_eq(& k->ind, key))    {    *prev=k->next;    free_svalue(& k->ind);    free_svalue(& k->val);    k->next=m->free_list;    m->free_list=k;    m->size--;   
pike.git/src/mapping.c:417:   #endif       if(!m->size) return;       if((m->ind_types | m->val_types) & (BIT_OBJECT | BIT_FUNCTION))    {    val_types = ind_types = 0;    m->val_types |= BIT_INT;    for(e=0;e<m->hashsize;e++)    { -  for(prev= m->hash + e;k=*prev;) +  for(prev= m->hash + e;(k=*prev);)    {    check_destructed(& k->val);       if((k->ind.type == T_OBJECT || k->ind.type == T_FUNCTION) &&    !k->ind.u.object->prog)    {    *prev=k->next;    free_svalue(& k->ind);    free_svalue(& k->val);    k->next=m->free_list;
pike.git/src/mapping.c:463: Inside #if defined(DEBUG)
     #ifdef DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif    if(!m->size) return 0;       if((1 << key->type) & m->ind_types)    {    h=hash_svalue(key) % m->hashsize;    -  for(prev= m->hash + h;k=*prev;prev=&k->next) +  for(prev= m->hash + h;(k=*prev);prev=&k->next)    {    if(is_eq(& k->ind, key))    {    *prev=k->next;    k->next=m->hash[h];    m->hash[h]=k;       return &k->val;    }    }
pike.git/src/mapping.c:494:    tmp.u.string=p;    return low_mapping_lookup(m, &tmp);   }      void mapping_index_no_free(struct svalue *dest,    struct mapping *m,    struct svalue *key)   {    struct svalue *p;    -  if(p=low_mapping_lookup(m,key)) +  if((p=low_mapping_lookup(m,key)))    {    if(p->type==T_INT)    p->subtype=NUMBER_NUMBER;       assign_svalue_no_free(dest, p);    }else{    dest->type=T_INT;    dest->u.integer=0;    dest->subtype=NUMBER_UNDEFINED;    }
pike.git/src/mapping.c:685:    for( ;p ;p=p->next)    if(p->pointer_a == (void *)a && p->pointer_b == (void *)b)    return 1;       check_mapping_for_destruct(a);    check_mapping_for_destruct(b);       LOOP(a)    {    struct svalue *s; -  if(s=low_mapping_lookup(b, & k->ind)) +  if((s=low_mapping_lookup(b, & k->ind)))    {    if(!low_is_equal(s, &k->val, &curr)) return 0;    }else{    return 0;    }    }    return 1;   }      void describe_mapping(struct mapping *m,struct processing *p,int indent)
pike.git/src/mapping.c:1065:    INT32 e;    struct keypair *k;    struct mapping *m,*next;       for(m=first_mapping;m;m=next)    {    m->refs++;       for(e=0;e<m->hashsize;e++)    { -  while(k=m->hash[e]) +  while((k=m->hash[e]))    {    m->hash[e]=k->next;    k->next=m->free_list;    m->free_list=k;    free_svalue(&k->ind);    free_svalue(&k->val);    }    }    m->size=0;