Commit 2c46f6bc 2c46f6bcd1624290c3c1af0df97756d3a81bd02d by Sergey Poznyakoff

Removed debugging hacks. Always call lt_dlinit

and add a call to lt_dlexit to the destructor.
1 parent 29c8fa53
...@@ -29,30 +29,21 @@ ...@@ -29,30 +29,21 @@
29 29
30 typedef int (*sieve_module_init_t) __PMT((sieve_machine_t mach)); 30 typedef int (*sieve_module_init_t) __PMT((sieve_machine_t mach));
31 31
32 static int inited = 0;
33
34 static void 32 static void
35 _free_loaded_module (void *data) 33 _free_loaded_module (void *data)
36 { 34 {
37 lt_dlclose ((lt_dlhandle)data); 35 lt_dlclose ((lt_dlhandle)data);
36 lt_dlexit ();
38 } 37 }
39 38
40 int wd ()
41 {
42 int volatile _s=0;
43 while (!_s);
44 }
45
46 static lt_dlhandle 39 static lt_dlhandle
47 load_module (sieve_machine_t mach, const char *name) 40 load_module (sieve_machine_t mach, const char *name)
48 { 41 {
49 lt_dlhandle handle; 42 lt_dlhandle handle;
50 if (!inited) 43
51 { 44 if (lt_dlinit ())
52 if (lt_dlinit ()) 45 return NULL;
53 return NULL; 46
54 inited++;
55 }
56 handle = lt_dlopenext (name); 47 handle = lt_dlopenext (name);
57 if (handle) 48 if (handle)
58 { 49 {
...@@ -74,6 +65,7 @@ load_module (sieve_machine_t mach, const char *name) ...@@ -74,6 +65,7 @@ load_module (sieve_machine_t mach, const char *name)
74 if (!handle) 65 if (!handle)
75 { 66 {
76 sieve_error (mach, "%s", lt_dlerror ()); 67 sieve_error (mach, "%s", lt_dlerror ());
68 lt_dlexit ();
77 } 69 }
78 return handle; 70 return handle;
79 } 71 }
......