pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.c:18:   #include "pike_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.125 2001/08/13 21:47:57 hubbe Exp $"); + RCSID("$Id: encode.c,v 1.126 2001/08/13 23:01:22 mast Exp $");      /* #define ENCODE_DEBUG */      #ifdef ENCODE_DEBUG   /* Pass a nonzero integer as the third arg to encode_value,    * encode_value_canonic and decode_value to activate this debug. */   #define EDB(N,X) do if (data->debug>=N) {X;} while (0)   #else   #define EDB(N,X) do {} while (0)   #endif
pike.git/src/encode.c:1272:    ptrdiff_t len;    ptrdiff_t ptr;    struct mapping *decoded;    struct unfinished_prog_link *unfinished_programs;    struct unfinished_obj_link *unfinished_objects;    struct svalue counter;    struct object *codec;    int pickyness;    struct pike_string *raw;    struct decode_data *next; + #ifdef PIKE_THREADS +  struct object *thread_id; + #endif   #ifdef ENCODE_DEBUG    int debug, depth;   #endif   };      static void decode_value2(struct decode_data *data);      static void fallback_codec(void)   {    size_t x;
pike.git/src/encode.c:2575:    d->next = d->next->next;    break;    }    }   #ifdef PIKE_DEBUG    if (!d) {    fatal("Decode data fell off the stack!\n");    }   #endif /* PIKE_DEBUG */    } + #ifdef PIKE_THREADS +  free_object(data->thread_id); + #endif   }      static INT32 my_decode(struct pike_string *tmp,    struct object *codec   #ifdef ENCODE_DEBUG    , int debug   #endif    )   {    ONERROR err;    struct decode_data d, *data;       /* Attempt to avoid infinite recursion on circular structures. */    for (data = current_decode; data; data=data->next) { -  if (data->raw == tmp) { +  if (data->raw == tmp && data->codec == codec + #ifdef PIKE_THREADS +  && data->thread_id == Pike_interpreter.thread_id + #endif +  ) {    struct svalue *res;    struct svalue val = {    T_INT, NUMBER_NUMBER,   #ifdef HAVE_UNION_INIT    {0}, /* Only to avoid warnings. */   #endif /* HAVE_UNION_INIT */    }; -  val.u.integer = 0; +  val.u.integer = COUNTER_START;    if ((res = low_mapping_lookup(data->decoded, &val))) {    push_svalue(res);    return 1;    }    /* Possible recursion detected. */    /* return 0; */    }    }       data=&d;
pike.git/src/encode.c:2619:    data->counter.u.integer=COUNTER_START;    data->data=(unsigned char *)tmp->str;    data->len=tmp->len;    data->ptr=0;    data->codec=codec;    data->pickyness=0;    data->unfinished_programs=0;    data->unfinished_objects=0;    data->raw = tmp;    data->next = current_decode; + #ifdef PIKE_THREADS +  data->thread_id = Pike_interpreter.thread_id; +  add_ref(Pike_interpreter.thread_id); + #endif   #ifdef ENCODE_DEBUG    data->debug = debug;    data->depth = -2;   #endif       if (tmp->size_shift) return 0;    if(data->len < 5) return 0;    if(GETC() != 182 ||    GETC() != 'k' ||    GETC() != 'e' ||