pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.c:18:   #include "error.h"   #include "operators.h"   #include "builtin_functions.h"   #include "module_support.h"   #include "fsort.h"   #include "threads.h"   #include "stuff.h"   #include "version.h"   #include "bignum.h"    - RCSID("$Id: encode.c,v 1.68 2000/08/17 18:50:32 grubba Exp $"); + RCSID("$Id: encode.c,v 1.69 2000/08/27 12:22:33 grubba Exp $");      /* #define ENCODE_DEBUG */      #ifdef ENCODE_DEBUG   #define EDB(X) X   #else   #define EDB(X)   #endif      /* The sp macro conflicts with Solaris 2.5.1's <sys/conf.h>. */
pike.git/src/encode.c:1141:    mapping_insert(m, Pike_sp-2, Pike_sp-1);    pop_n_elems(2);    }    ref_push_mapping(m);    return;    }       case TAG_MULTISET:    {    struct multiset *m; +  struct array *a;    if(num<0)    error("Failed to decode string. (multiset size is negative)\n");       /* Heruetical */    if(data->ptr + num > data->len)    error("Failed to decode multiset. (not enough data)\n");    -  m=mkmultiset(low_allocate_array(0, num)); -  tmp.type=T_MULTISET; -  tmp.u.multiset=m; +  /* NOTE: This code knows stuff about the implementation of multisets...*/ +  a = low_allocate_array(num, 0); +  m = allocate_multiset(a); +  tmp.type = T_MULTISET; +  tmp.u.multiset = m;    mapping_insert(data->decoded, & data->counter, &tmp);    data->counter.u.integer++; -  m->refs--; +     debug_malloc_touch(m);       for(e=0;e<num;e++)    {    decode_value2(data); -  multiset_insert(m, Pike_sp-1); -  pop_stack(); +  a->item[e] = sp[-1]; +  sp--; +  dmalloc_touch_svalue(sp);    } -  ref_push_multiset(m); +  array_fix_type_field(a); +  order_multiset(m); +  push_multiset(m);    return;    }          case TAG_OBJECT:    tmp=data->counter;    data->counter.u.integer++;    decode_value2(data);       switch(num)