Branch: Tag:

2003-06-06

2003-06-06 14:30:02 by Henrik Grubbström (Grubba) <grubba@grubba.org>

load_module() is now aware of end_program() being able to return NULL.

Rev: src/dynamic_load.c:1.70

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: dynamic_load.c,v 1.69 2003/04/07 17:28:55 nilsson Exp $ + || $Id: dynamic_load.c,v 1.70 2003/06/06 14:30:02 grubba Exp $   */      #ifdef TESTING
24:   # include "language.h"   # include "lex.h"    - RCSID("$Id: dynamic_load.c,v 1.69 2003/04/07 17:28:55 nilsson Exp $"); + RCSID("$Id: dynamic_load.c,v 1.70 2003/06/06 14:30:02 grubba Exp $");      #else /* TESTING */   
350:      static void cleanup_compilation(struct compilation_save *save)   { -  free_program(end_program()); +  struct program *p = end_program(); +  if (p) { +  free_program(p); +  }    free_string(lex.current_file);    compilation_depth = save->compilation_depth;    lex = save->lex;
492:   #endif       pop_n_elems(args); -  push_program(end_program()); +  { +  struct program *p = end_program();    free_string(lex.current_file);    compilation_depth = save.compilation_depth;    lex = save.lex; -  +  if (p) { +  push_program(p);    add_ref(new_module->module_prog = Pike_sp[-1].u.program); -  +  } else { +  /* Initialization failed. */ +  new_module->exit(); +  dlclose(module); +  dynamic_module_list = new_module->next; +  free(new_module); +  if (strlen(module_name) < 1024) { +  Pike_error("Failed to initialize dynamic module \"%s\".\n", module_name); +  } else { +  Pike_error("Failed to initialize dynamic module.\n");    } -  +  } +  } + }      #endif /* USE_DYNAMIC_MODULES */