pike.git / src / mapping.c

version» Context lines:

pike.git/src/mapping.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: mapping.c,v 1.203 2008/06/24 19:35:51 grubba Exp $ + || $Id: mapping.c,v 1.204 2008/06/25 16:15:43 grubba Exp $   */      #include "global.h"   #include "main.h"   #include "object.h"   #include "mapping.h"   #include "svalue.h"   #include "array.h"   #include "pike_macros.h"   #include "pike_error.h"
pike.git/src/mapping.c:1502:    for (k2 = a_md->hash[h]; k2; k2 = k2->next) {    if ((k2->hval == k->hval) && is_eq(&k2->ind, &k->ind)) {    break;    }    }    if (!k2) {    map_delete(res, &k->ind);    }    }    UNSET_ONERROR(err); -  if (a_md->generation_cnt > b_md->generation_cnt) -  res->data->generation_cnt = a_md->generation_cnt; -  else -  res->data->generation_cnt = b_md->generation_cnt; +     return res;   }      static struct mapping *or_mappings(struct mapping *a, struct mapping *b)   {    struct mapping *res;    struct keypair *k;    struct mapping_data *a_md = a->data;    struct mapping_data *b_md = b->data;    INT32 e;
pike.git/src/mapping.c:1541:    for (k2 = b_md->hash[h]; k2; k2 = k2->next) {    if ((k2->hval == k->hval) && is_eq(&k2->ind, &k->ind)) {    break;    }    }    if (!k2) {    mapping_insert(res, &k->ind, &k->val);    }    }    UNSET_ONERROR(err); -  if (a_md->generation_cnt > b_md->generation_cnt) -  res->data->generation_cnt = a_md->generation_cnt; -  else -  res->data->generation_cnt = b_md->generation_cnt; +     return res;   }      static struct mapping *xor_mappings(struct mapping *a, struct mapping *b)   {    struct mapping *res;    struct keypair *k;    struct mapping_data *a_md = a->data;    struct mapping_data *b_md = b->data;    INT32 e;
pike.git/src/mapping.c:1589:    break;    }    }    if (!k2) {    mapping_insert(res, &k->ind, &k->val);    } else {    map_delete(res, &k2->ind);    }    }    UNSET_ONERROR(err); -  if (a_md->generation_cnt > b_md->generation_cnt) -  res->data->generation_cnt = a_md->generation_cnt; -  else -  res->data->generation_cnt = b_md->generation_cnt; +     return res;   }      PMOD_EXPORT struct mapping *merge_mappings(struct mapping *a, struct mapping *b, INT32 op)   {    ONERROR r1,r2,r3,r4;    struct array *ai, *av;    struct array *bi, *bv;    struct array *ci, *cv;    INT32 *zipper;
pike.git/src/mapping.c:1669:       UNSET_ONERROR(r2); free_array(bv);    UNSET_ONERROR(r1); free_array(av);       free((char *)zipper);       m=mkmapping(ci, cv);    free_array(ci);    free_array(cv);    -  if (a->data->generation_cnt > b->data->generation_cnt) -  m->data->generation_cnt = a->data->generation_cnt; -  else -  m->data->generation_cnt = b->data->generation_cnt; +     return m;   }      /* FIXME: What are the semantics for this function?    * FIXME: It ought to be optimized just like the unordered variant.    * /grubba 2003-11-12    */   PMOD_EXPORT struct mapping *merge_mapping_array_ordered(struct mapping *a,    struct array *b, INT32 op)   {
pike.git/src/mapping.c:1726:       UNSET_ONERROR(r2); free_array(av);    UNSET_ONERROR(r1); free_array(ai);       free((char *)zipper);       m=mkmapping(ci, cv);    free_array(ci);    free_array(cv);    -  m->data->generation_cnt = a->data->generation_cnt; +     return m;   }      PMOD_EXPORT struct mapping *merge_mapping_array_unordered(struct mapping *a,    struct array *b, INT32 op)   {    ONERROR r1;    struct array *b_temp;    INT32 *zipper;    struct mapping *m;
pike.git/src/mapping.c:1758:    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=0;    struct keypair *k; -  int generation = 0; +        for(e=d=0;d<args;d++)    {    struct mapping *m = argp[d].u.mapping;   #ifdef PIKE_DEBUG    if(d_flag>1) check_mapping(m);   #endif    e += m->data->size;    }   
pike.git/src/mapping.c:1804:    ret=allocate_mapping(MAP_SLOTS(e));    break;       }       for(;d<args;d++)    {    struct mapping *m=argp[d].u.mapping;    struct mapping_data *md=m->data;    -  if (md->generation_cnt > generation) -  generation = md->generation_cnt; -  +     add_ref(md);    NEW_MAPPING_LOOP(md)    low_mapping_insert(ret, &k->ind, &k->val, 2);    free_mapping_data(md);    }   #ifdef PIKE_DEBUG    if(!ret)    Pike_fatal("add_mappings is confused!\n");   #endif -  ret->data->generation_cnt = generation; +     return ret;   }      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;