pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:1:   /* -*- c -*- -  * $Id: builtin.cmod,v 1.46 2001/06/25 20:03:39 grubba Exp $ +  * $Id: builtin.cmod,v 1.47 2001/06/25 22:19:18 mast Exp $    */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "opcodes.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"
pike.git/src/builtin.cmod:882:    *! (eg passwords).    *!    *! @seealso    *! @[catch()], @[throw()]    */   PMOD_EXPORT   PIKEFUN array(mixed) backtrace()    efun;    optflags OPT_EXTERNAL_DEPEND;   { -  struct pike_frame *f; +  struct pike_frame *f, *of = 0;    int size = 0;    struct array *res = NULL;       for (f = Pike_fp; f; f = f->next) {    size++;    }       res = allocate_array_no_init(size, 0);    push_array(res);    -  for (f = Pike_fp; f && size; f = f->next) { +  for (f = Pike_fp; f && size; f = (of = f)->next) {    struct object *o = low_clone(backtrace_frame_program);    struct backtrace_frame_struct *bf;       call_c_initializers(o);       size--;       res->item[size].u.object = o;    res->item[size].type = PIKE_T_OBJECT;    res->item[size].subtype = 0;
pike.git/src/builtin.cmod:926:    bf->fun.type = PIKE_T_FUNCTION;    } else {    bf->fun.u.integer = 0;    bf->fun.subtype = NUMBER_DESTRUCTED;    bf->fun.type = PIKE_T_INT;    }       if (f->locals) {    INT32 numargs = DO_NOT_WARN((INT32) MINIMUM(f->num_args,    Pike_sp - f->locals)); +  if(of) +  /* f->num_args can be too large, so this is necessary for some +  * reason. I don't know why. /mast */ +  numargs = DO_NOT_WARN((INT32)MINIMUM(f->num_args,of->locals - f->locals));       numargs = MAXIMUM(numargs, 0);       if (numargs) {    bf->args = allocate_array_no_init(numargs, 0);    assign_svalues_no_free(bf->args->item, f->locals, numargs, BIT_MIXED);    }    }    }    /* NOTE: res has already been pushed on the stack. */