pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:1:   /*   || 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: program.c,v 1.611 2007/01/16 18:22:41 grubba Exp $ + || $Id: program.c,v 1.612 2007/01/16 18:31:18 grubba Exp $   */      #include "global.h"   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "lex.h"
pike.git/src/program.c:2281:       if(p->flags & PROGRAM_FINISHED)    {    yyerror("Pass2: Program already done");    }       Pike_compiler->malloc_size_program = ALLOC_STRUCT(program);    Pike_compiler->fake_object=alloc_object();      #ifdef PIKE_DEBUG -  Pike_compiler->fake_object->storage=(char *)xalloc(256 * sizeof(struct svalue)); +  Pike_compiler->fake_object->storage=(char *)malloc(256 * sizeof(struct svalue)); +  if (Pike_compiler->fake_object->storage) {    /* Stipple to find illegal accesses */    MEMSET(Pike_compiler->fake_object->storage,0x55,256*sizeof(struct svalue)); -  +  }   #else    Pike_compiler->fake_object->storage=(char *)malloc(sizeof(struct parent_info));   #endif -  +  if (!Pike_compiler->fake_object->storage) { +  yyerror("Out of memory when allocating object storage."); +  }    /* Can't use GC_ALLOC on fake objects, but still it's good to know    * that they never take over a stale gc marker. */    if (Pike_in_gc) remove_marker(Pike_compiler->fake_object);       Pike_compiler->fake_object->next=Pike_compiler->fake_object;    Pike_compiler->fake_object->prev=Pike_compiler->fake_object;    Pike_compiler->fake_object->refs=0;    add_ref(Pike_compiler->fake_object); /* For DMALLOC... */    Pike_compiler->fake_object->prog=p;    add_ref(p);
pike.git/src/program.c:2309:    Pike_compiler->fake_object->program_id=p->id;   #endif      #ifdef PIKE_SECURITY    Pike_compiler->fake_object->prot=0;   #endif       debug_malloc_touch(Pike_compiler->fake_object);    debug_malloc_touch(Pike_compiler->fake_object->storage);    +  if (Pike_compiler->fake_object->storage) {    if(name)    {    /* Fake objects have parents regardless of PROGRAM_USE_PARENT */    if((((struct parent_info *)Pike_compiler->fake_object->storage)->parent=Pike_compiler->previous->fake_object))    add_ref(Pike_compiler->previous->fake_object);    ((struct parent_info *)Pike_compiler->fake_object->storage)->parent_identifier=id;    }else{    ((struct parent_info *)Pike_compiler->fake_object->storage)->parent=0;    ((struct parent_info *)Pike_compiler->fake_object->storage)->parent_identifier=0;    } -  +  }       Pike_compiler->new_program=p;      #ifdef PROGRAM_BUILD_DEBUG    if (name) {    fprintf (stderr, "%.*sstarting program %d (pass=%d): ",    compilation_depth, " ", Pike_compiler->new_program->id, Pike_compiler->compiler_pass);    push_string (name);    print_svalue (stderr, --Pike_sp);    putc ('\n', stderr);