Branch: Tag:

1999-11-12

1999-11-12 07:34:32 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

better map_delete

Rev: src/mapping.c:1.46
Rev: src/mapping.h:1.16

5:   \*/   /**/   #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"
373:    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;
389:    {    *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;
403:    return;    }    } +  if(to) +  { +  to->type=T_INT; +  to->subtype=NUMBER_UNDEFINED; +  to->u.integer=0;    } -  + }      void check_mapping_for_destruct(struct mapping *m)   {
504:    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)   {