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.30 1998/04/24 00:01:32 hubbe Exp $"); + RCSID("$Id: mapping.c,v 1.31 1998/04/27 09:55:32 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:687:       m=mkmapping(ci, cv);    free_array(ci);    free_array(cv);       return m;   }      struct mapping *add_mappings(struct svalue *argp, INT32 args)   { -  struct mapping *ret,*a,*b; -  switch(args) -  { -  case 0: return allocate_mapping(0); -  case 1: return copy_mapping(argp->u.mapping); -  case 2: return merge_mappings(argp[0].u.mapping, argp[1].u.mapping, OP_ADD); -  case 3: -  a=merge_mappings(argp[0].u.mapping,argp[1].u.mapping,OP_ADD); -  ret=merge_mappings(a,argp[2].u.mapping,OP_ADD); -  free_mapping(a); +  INT32 e,d; +  struct mapping *ret; +  struct keypair *k; +  +  for(e=d=0;d<args;d++) e+=argp[d].u.mapping->size; +  ret=allocate_mapping(MAP_SLOTS(e)); +  for(d=0;d<args;d++) +  LOOP(argp[d].u.mapping) +  mapping_insert(ret, &k->ind, &k->val);    return ret; -  default: -  a=add_mappings(argp,args/2); -  b=add_mappings(argp+args/2,args-args/2); -  ret=merge_mappings(a,b,OP_ADD); -  free_mapping(a); -  free_mapping(b); -  return ret; +    } - } +       int mapping_equal_p(struct mapping *a, struct mapping *b, struct processing *p)   {    struct processing curr;    struct keypair *k;    INT32 e;       if(a==b) return 1;    if(a->size != b->size) return 0;