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.102 2000/09/08 16:38:20 grubba Exp $"); + RCSID("$Id: mapping.c,v 1.103 2000/09/08 17:31:26 hubbe Exp $");   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "error.h"   #include "pike_memory.h"   #include "dynamic_buffer.h"   #include "interpret.h"
pike.git/src/mapping.c:1427:    }    else    m=merge_mapping_array_ordered(a,b,op);       return m;   }      PMOD_EXPORT struct mapping *add_mappings(struct svalue *argp, INT32 args)   {    INT32 e,d; -  struct mapping *ret; +  struct mapping *ret=0;    struct keypair *k;       for(e=d=0;d<args;d++)    {   #ifdef PIKE_DEBUG    if(d_flag>1) check_mapping(argp[d].u.mapping);   #endif    e+=argp[d].u.mapping->data->size;    }   
pike.git/src/mapping.c:1449:       d=0;       for(;d<args;d++)    {    struct mapping *m=argp[d].u.mapping;    struct mapping_data *md=m->data;       if(md->size == 0) continue;    +  if(!(md->flags && MAPPING_FLAG_WEAK)) +  {   #if 1 /* major optimization */ -  if(e==md->size && !(md->flags && MAPPING_FLAG_WEAK)) +  if(e==md->size)    return copy_mapping(m);   #endif       if(m->refs == 1 && !md->hardlinks)    {    add_ref( ret=m );    d++; -  }else{ +  break; +  } +  }    ret=allocate_mapping(MAP_SLOTS(e)); -  +  break; +     }       for(;d<args;d++)    { -  m=argp[d].u.mapping; -  md=m->data; +  struct mapping *m=argp[d].u.mapping; +  struct mapping_data *md=m->data;       add_ref(md);    NEW_MAPPING_LOOP(md)    mapping_insert(ret, &k->ind, &k->val);    free_mapping_data(md);    } -  + #ifdef PIKE_DEBUG +  if(!ret) +  fatal("add_mappings is confused!\n"); + #endif    return ret;   } -  fatal("add_mappings is confused!\n"); - } +       PMOD_EXPORT int mapping_equal_p(struct mapping *a, struct mapping *b, struct processing *p)   {    struct processing curr;    struct keypair *k;    struct mapping_data *md;    INT32 e,eq=1;      #ifdef PIKE_DEBUG    if(a->data->refs <=0)