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.45 1999/10/30 06:13:19 mast Exp $"); + RCSID("$Id: mapping.c,v 1.46 1999/11/12 07:34:31 hubbe Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "language.h"   #include "error.h"   #include "pike_memory.h"   #include "dynamic_buffer.h"
pike.git/src/mapping.c:366:       if(t != T_INT) return 0;      #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif       return & ( k->val.u );   }    - void map_delete(struct mapping *m, -  struct svalue *key) + void map_delete_no_free(struct mapping *m, +  struct svalue *key, +  struct svalue *to)   {    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)    {    if(is_eq(& k->ind, key))    {    *prev=k->next;    free_svalue(& k->ind); -  +  if(to) +  to[0]=k->val; +  else    free_svalue(& k->val);    k->next=m->free_list;    m->free_list=k;    m->size--;       if(m->size < (m->hashsize + 1) * MIN_LINK_LENGTH)    rehash(m, MAP_SLOTS(m->size));      #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif    return;    }    } -  +  if(to) +  { +  to->type=T_INT; +  to->subtype=NUMBER_UNDEFINED; +  to->u.integer=0;    } -  + }      void check_mapping_for_destruct(struct mapping *m)   {    INT32 e;    struct keypair *k, **prev;    TYPE_FIELD ind_types, val_types;      #ifdef PIKE_DEBUG    if(d_flag > 1) check_mapping_type_fields(m);   #endif
pike.git/src/mapping.c:497:   void mapping_string_insert(struct mapping *m,    struct pike_string *p,    struct svalue *val)   {    struct svalue tmp;    tmp.type=T_STRING;    tmp.u.string=p;    mapping_insert(m, &tmp, val);   }    + void mapping_string_insert_string(struct mapping *m, +  struct pike_string *p, +  struct pike_string *val) + { +  struct svalue tmp; +  tmp.type=T_STRING; +  tmp.u.string=val; +  mapping_string_insert(m, p, &tmp); + } +    struct svalue *simple_mapping_string_lookup(struct mapping *m,    char *p)   {    struct pike_string *tmp;    if((tmp=findstring(p)))    return low_mapping_string_lookup(m,tmp);    return 0;   }      struct svalue *mapping_mapping_lookup(struct mapping *m,