Branch: Tag:

2001-07-02

2001-07-02 20:09:18 by Martin Stjernholm <mast@lysator.liu.se>

Take more care to avoid leaving throw_svalue around with a backtrace.

Rev: src/builtin_functions.c:1.390
Rev: src/cpp.c:1.90
Rev: src/interpret.c:1.212
Rev: src/interpret.h:1.91
Rev: src/language.yacc:1.255
Rev: src/las.c:1.255
Rev: src/mapping.c:1.129
Rev: src/modules/Java/jvm.c:1.34
Rev: src/object.c:1.176
Rev: src/pike_error.h:1.12
Rev: src/preprocessor.h:1.43
Rev: src/svalue.c:1.110

5:   \*/   /**/   #include "global.h" - RCSID("$Id: interpret.c,v 1.211 2001/07/02 04:09:48 hubbe Exp $"); + RCSID("$Id: interpret.c,v 1.212 2001/07/02 20:09:17 mast Exp $");   #include "interpret.h"   #include "object.h"   #include "program.h"
1619:    return ret;   }    - PMOD_EXPORT void safe_apply_low(struct object *o,int fun,int args) + PMOD_EXPORT void safe_apply_low2(struct object *o,int fun,int args, int handle_errors)   {    JMP_BUF recovery;   
1628:    throw_value.type=T_INT;    if(SETJMP(recovery))    { -  if(throw_value.type != T_INT) -  call_handle_error(); +  if(handle_errors) call_handle_error();    Pike_sp->u.integer = 0;    Pike_sp->subtype=NUMBER_NUMBER;    Pike_sp->type = T_INT;
1651:    UNSETJMP(recovery);   }    + PMOD_EXPORT void safe_apply_low(struct object *o,int fun,int args) + { +  safe_apply_low2(o, fun, args, 1); + }      PMOD_EXPORT void safe_apply(struct object *o, char *fun ,INT32 args)   {   #ifdef PIKE_DEBUG    if(!o->prog) fatal("Apply safe on destructed object.\n");   #endif -  safe_apply_low(o, find_identifier(fun, o->prog), args); +  safe_apply_low2(o, find_identifier(fun, o->prog), args, 1);   }      PMOD_EXPORT void safe_apply_handler(const char *fun,
1666:    INT32 args)   {    int i; +  free_svalue(&throw_value); +  throw_value.type = T_INT;    if (handler && handler->prog &&    (i = find_identifier(fun, handler->prog)) != -1) { -  safe_apply_low(handler, i, args); +  safe_apply_low2(handler, i, args, 0);    } else if (compat && compat->prog &&    (i = find_identifier(fun, compat->prog)) != -1) { -  safe_apply_low(compat, i, args); +  safe_apply_low2(compat, i, args, 0);    } else {    struct object *master_obj = master();    i = find_identifier(fun, master_obj->prog); -  safe_apply_low(master_obj, i, args); +  safe_apply_low2(master_obj, i, args, 0);    } -  +  if (throw_value.type != T_STRING && throw_value.type != T_INT) { +  free_svalue(&throw_value); +  throw_value.type = T_INT;    } -  + }      PMOD_EXPORT void apply_lfun(struct object *o, int fun, int args)   {