Skip to content
Snippets Groups Projects
Commit e00cc8de authored by Martin Stjernholm's avatar Martin Stjernholm
Browse files

Fixed inconsistent macros that caused only half the dynamic module

stuff to be compiled under certain conditions. Fixed bug that caused
leak of the dynamic_module_list entries.

Rev: src/dynamic_load.c:1.46
parent 85759dbe
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
# include "pike_macros.h" # include "pike_macros.h"
# include "main.h" # include "main.h"
RCSID("$Id: dynamic_load.c,v 1.45 2000/09/28 15:37:23 grubba Exp $"); RCSID("$Id: dynamic_load.c,v 1.46 2000/09/29 15:31:31 mast Exp $");
#endif /* !TESTING */ #endif /* !TESTING */
...@@ -224,6 +224,10 @@ static void dlclose(void *module) ...@@ -224,6 +224,10 @@ static void dlclose(void *module)
#ifndef TESTING #ifndef TESTING
#if defined(HAVE_DLOPEN) || defined(USE_DLD) || defined(USE_HPUX_DL) || defined(USE_LOADLIBRARY) #if defined(HAVE_DLOPEN) || defined(USE_DLD) || defined(USE_HPUX_DL) || defined(USE_LOADLIBRARY)
#define USE_DYNAMIC_MODULES
#endif
#ifdef USE_DYNAMIC_MODULES
struct module_list struct module_list
{ {
...@@ -326,12 +330,12 @@ void f_load_module(INT32 args) ...@@ -326,12 +330,12 @@ void f_load_module(INT32 args)
push_program(end_program()); push_program(end_program());
} }
#endif /* HAVE_DLOPEN || USE_DLD || USE_HPUX_DL */ #endif /* USE_DYNAMIC_MODULES */
void init_dynamic_load(void) void init_dynamic_load(void)
{ {
#if defined(HAVE_DLOPEN) || defined(USE_DLD) || defined(USE_HPUX_DL) || defined(USE_LOADLIBRARY) #ifdef USE_DYNAMIC_MODULES
dlinit(); dlinit();
...@@ -344,20 +348,17 @@ void init_dynamic_load(void) ...@@ -344,20 +348,17 @@ void init_dynamic_load(void)
/* Call the pike_module_exit() callbacks for the dynamic modules. */ /* Call the pike_module_exit() callbacks for the dynamic modules. */
void exit_dynamic_load(void) void exit_dynamic_load(void)
{ {
#if defined(HAVE_DLOPEN) || defined(USE_DLD) || defined(USE_HPUX_DL) #ifdef USE_DYNAMIC_MODULES
while(dynamic_module_list) struct module_list *tmp;
{ for (tmp = dynamic_module_list; tmp; tmp = tmp->next)
struct module_list *tmp=dynamic_module_list;
dynamic_module_list=tmp->next;
(*tmp->exit)(); (*tmp->exit)();
}
#endif #endif
} }
/* Unload all the dynamically loaded modules. */ /* Unload all the dynamically loaded modules. */
void free_dynamic_load(void) void free_dynamic_load(void)
{ {
#if defined(HAVE_DLOPEN) || defined(USE_DLD) || defined(USE_HPUX_DL) #ifdef USE_DYNAMIC_MODULES
while(dynamic_module_list) while(dynamic_module_list)
{ {
struct module_list *tmp=dynamic_module_list; struct module_list *tmp=dynamic_module_list;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment