Branch: Tag:

2003-02-17

2003-02-17 19:31:41 by Martin Stjernholm <mast@lysator.liu.se>

Temporarily set compilation_depth to -1 while decoding programs to avoid
unwanted parent pointers etc. (This only affects the new encoder/decoder for
programs, which currently is disabled by default.)

Rev: src/encode.c:1.159

2:   || 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: encode.c,v 1.158 2002/11/23 20:05:14 mast Exp $ + || $Id: encode.c,v 1.159 2003/02/17 19:31:41 mast Exp $   */      #include "global.h"
27:   #include "bignum.h"   #include "pikecode.h"    - RCSID("$Id: encode.c,v 1.158 2002/11/23 20:05:14 mast Exp $"); + RCSID("$Id: encode.c,v 1.159 2003/02/17 19:31:41 mast Exp $");      /* #define ENCODE_DEBUG */   
1992:    (X)=pop_unfinished_type(); \   } while(0)    + static void cleanup_new_program_decode (int *orig_compilation_depth) + { +  end_first_pass(0); +  compilation_depth = *orig_compilation_depth; + } +    static void decode_value2(struct decode_data *data)      #ifdef PIKE_DEBUG
2996:    {    struct program *p;    ONERROR err; +  int orig_compilation_depth;    int byteorder;    int bytecode_method;    int entry_type;
3036:    p_flags |= PROGRAM_AVOID_CHECK;       /* Start the new program. */ +  orig_compilation_depth = compilation_depth; +  compilation_depth = -1;    low_start_new_program(NULL, NULL, 0, NULL);    p = Pike_compiler->new_program;   
3044:    /* Kludge to get end_first_pass() to free the program. */    Pike_compiler->num_parse_error++;    -  SET_ONERROR(err, end_first_pass, 0); +  SET_ONERROR(err, cleanup_new_program_decode, &orig_compilation_depth);       debug_malloc_touch(p);   
3492:    if (!(p = end_first_pass(2))) {    Pike_error("Failed to decode program.\n");    } +  compilation_depth = orig_compilation_depth;    push_program(p);       /* Verify... */