service_new: ready_confirm_fd
[oweals/gnunet.git] / src / util / plugin.c
index 40319c737ee74de761e03c773a0b570c4f2f0ea2..c7ac47a7c355fb96f0661e451abacb30f01a593a 100644 (file)
@@ -1,6 +1,6 @@
 /*
      This file is part of GNUnet
-     (C) 2002-2013 Christian Grothoff (and other contributing authors)
+     Copyright (C) 2002-2013 GNUnet e.V.
 
      GNUnet is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -14,8 +14,8 @@
 
      You should have received a copy of the GNU General Public License
      along with GNUnet; see the file COPYING.  If not, write to the
-     Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-     Boston, MA 02111-1307, USA.
+     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+     Boston, MA 02110-1301, USA.
 */
 
 /**
@@ -57,7 +57,6 @@ struct PluginList
  */
 static int initialized;
 
-
 /**
  * Libtool search path before we started.
  */
@@ -89,12 +88,12 @@ plugin_init ()
     return;
   }
   opath = lt_dlgetsearchpath ();
-  if (opath != NULL)
+  if (NULL != opath)
     old_dlsearchpath = GNUNET_strdup (opath);
   path = GNUNET_OS_installation_get_path (GNUNET_OS_IPK_LIBDIR);
-  if (path != NULL)
+  if (NULL != path)
   {
-    if (opath != NULL)
+    if (NULL != opath)
     {
       GNUNET_asprintf (&cpath, "%s:%s", opath, path);
       lt_dlsetsearchpath (cpath);
@@ -117,7 +116,7 @@ static void
 plugin_fini ()
 {
   lt_dlsetsearchpath (old_dlsearchpath);
-  if (old_dlsearchpath != NULL)
+  if (NULL != old_dlsearchpath)
   {
     GNUNET_free (old_dlsearchpath);
     old_dlsearchpath = NULL;
@@ -134,12 +133,16 @@ plugin_fini ()
  * @return NULL if the symbol was not found
  */
 static GNUNET_PLUGIN_Callback
-resolve_function (struct PluginList *plug, const char *name)
+resolve_function (struct PluginList *plug,
+                  const char *name)
 {
   char *initName;
   void *mptr;
 
-  GNUNET_asprintf (&initName, "_%s_%s", plug->name, name);
+  GNUNET_asprintf (&initName,
+                   "_%s_%s",
+                   plug->name,
+                   name);
   mptr = lt_dlsym (plug->handle, &initName[1]);
   if (NULL == mptr)
     mptr = lt_dlsym (plug->handle, initName);
@@ -278,7 +281,7 @@ GNUNET_PLUGIN_unload (const char *library_name,
     plugins = pos->next;
   else
     prev->next = pos->next;
//  lt_dlclose (pos->handle);
+  lt_dlclose (pos->handle);
   GNUNET_free (pos->name);
   GNUNET_free (pos);
   if (NULL == plugins)