aboutsummaryrefslogtreecommitdiff
path: root/src/common/helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/helper.c')
-rw-r--r--src/common/helper.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/common/helper.c b/src/common/helper.c
index c4aa8e18..c8065716 100644
--- a/src/common/helper.c
+++ b/src/common/helper.c
@@ -257,6 +257,7 @@ static void connector(const gchar *handler_name,
257 Plugin * plug = user_data; 257 Plugin * plug = user_data;
258 void * method; 258 void * method;
259 259
260 method = NULL;
260 while (plug != NULL) { 261 while (plug != NULL) {
261 method = trybindDynamicMethod(plug->library, 262 method = trybindDynamicMethod(plug->library,
262 "", 263 "",
@@ -283,8 +284,7 @@ void connectGladeWithPlugins(GladeXML * xml) {
283 284
284typedef void (*PlainCall)(); 285typedef void (*PlainCall)();
285 286
286static Plugin * loadPlugin(const char * name, 287static void loadPlugin(const char * name) {
287 Plugin * next) {
288 Plugin * p; 288 Plugin * p;
289 void * lib; 289 void * lib;
290 PlainCall init; 290 PlainCall init;
@@ -295,29 +295,27 @@ static Plugin * loadPlugin(const char * name,
295 LOG(LOG_WARNING, 295 LOG(LOG_WARNING,
296 _("Failed to load plugin '%s'\n"), 296 _("Failed to load plugin '%s'\n"),
297 name); 297 name);
298 return next; 298 return;
299 } 299 }
300 p = MALLOC(sizeof(Plugin)); 300 p = MALLOC(sizeof(Plugin));
301 p->name = STRDUP(name); 301 p->name = STRDUP(name);
302 p->next = next; 302 p->next = plugin;
303 p->library = lib; 303 p->library = lib;
304 plugin = p;
304 init = trybindDynamicMethod(lib, 305 init = trybindDynamicMethod(lib,
305 "init_", 306 "init_",
306 name); 307 name);
307 if (init != NULL) 308 if (init != NULL)
308 init(); 309 init();
309
310 return p;
311} 310}
312 311
313static Plugin * loadPlugins(const char * names, 312static void loadPlugins(const char * names) {
314 Plugin * plug) {
315 char * dup; 313 char * dup;
316 char * next; 314 char * next;
317 const char * pos; 315 const char * pos;
318 316
319 if (names == NULL) 317 if (names == NULL)
320 return plug; 318 return;
321 319
322 dup = STRDUP(names); 320 dup = STRDUP(names);
323 next = dup; 321 next = dup;
@@ -338,11 +336,10 @@ static Plugin * loadPlugins(const char * names,
338 LOG(LOG_DEBUG, 336 LOG(LOG_DEBUG,
339 "Loading plugin '%s'\n", 337 "Loading plugin '%s'\n",
340 pos); 338 pos);
341 plug = loadPlugin(pos, plug); 339 loadPlugin(pos);
342 } 340 }
343 } while (next != NULL); 341 } while (next != NULL);
344 FREE(dup); 342 FREE(dup);
345 return plug;
346} 343}
347 344
348static void unloadPlugin(Plugin * plug) { 345static void unloadPlugin(Plugin * plug) {
@@ -392,7 +389,7 @@ void initGNUnetGTKCommon() {
392 "PLUGINS"); 389 "PLUGINS");
393 if (load == NULL) 390 if (load == NULL)
394 load = STRDUP("about daemon fs"); 391 load = STRDUP("about daemon fs");
395 plugin = loadPlugins(load, NULL); 392 loadPlugins(load);
396 FREE(load); 393 FREE(load);
397 394
398 connectGladeWithPlugins(mainXML); 395 connectGladeWithPlugins(mainXML);