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.49 2000/01/27 23:18:25 hubbe Exp $"); + RCSID("$Id: mapping.c,v 1.50 2000/01/28 00:46:26 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:1433:       return ret;   }         void mapping_search_no_free(struct svalue *to,    struct mapping *m,    struct svalue *look_for,    struct svalue *key /* start */)   { -  unsigned INT32 h2,h=0; -  struct keypair *k=0, **prev; +     struct mapping_data *md, *omd;      #ifdef PIKE_DEBUG    if(m->data->refs <=0)    fatal("Zero refs i mapping->data\n");   #endif -  +  md=m->data;    -  +  if(md->size) +  { +  unsigned INT32 h2,h=0; +  struct keypair *k=md->hash[0], **prev; +     if(key)    {    h2=hash_svalue(key);       FIND(); -  +  +  if(!k) +  { +  to->type=T_INT; +  to->subtype=NUMBER_UNDEFINED; +  to->u.integer=0; +  return;    } -  +  }          md=m->data;    if(md->size)    {    md->valrefs++;    add_ref(md);    -  while(h < (unsigned INT32)md->hashsize) +  if(h < (unsigned INT32)md->hashsize)    { -  +  while(1) +  {    while(k)    {    if(is_eq(look_for, &k->val))    {    assign_svalue_no_free(to,&k->ind);       md->valrefs--;    free_mapping_data(md);    return;    }    k=k->next;    } -  k=md->hash[++h]; +  h++; +  if(h>= (unsigned INT32)md->hashsize) +  break; +  k=md->hash[h];    }    } -  +  }       md->valrefs--;    free_mapping_data(md); -  +  }       to->type=T_INT;    to->subtype=NUMBER_UNDEFINED;    to->u.integer=0;   }         #ifdef PIKE_DEBUG      void check_mapping(struct mapping *m)