This file is part of GNUnet
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
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ Affero General Public License for more details.
- 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., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
/**
* @file util/plugin.c
#include <ltdl.h>
#include "gnunet_util_lib.h"
-#define LOG(kind,...) GNUNET_log_from (kind, "util-plugin", __VA_ARGS__)
+#define LOG(kind, ...) GNUNET_log_from (kind, "util-plugin", __VA_ARGS__)
/**
* Linked list of active plugins.
err = lt_dlinit ();
if (err > 0)
{
- FPRINTF (stderr,
- _("Initialization of plugin mechanism failed: %s!\n"),
+ fprintf (stderr,
+ _ ("Initialization of plugin mechanism failed: %s!\n"),
lt_dlerror ());
return;
}
* @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);
if (NULL == mptr)
LOG (GNUNET_ERROR_TYPE_ERROR,
- _("`%s' failed to resolve method '%s' with error: %s\n"),
+ _ ("`%s' failed to resolve method '%s' with error: %s\n"),
"lt_dlsym",
- &initName[1], lt_dlerror ());
+ &initName[1],
+ lt_dlerror ());
GNUNET_free (initName);
return mptr;
}
GNUNET_PLUGIN_Callback init;
void *ret;
- if (!initialized)
+ if (! initialized)
{
initialized = GNUNET_YES;
plugin_init ();
if (libhandle == NULL)
{
LOG (GNUNET_ERROR_TYPE_ERROR,
- _("`%s' failed for library `%s' with error: %s\n"),
+ _ ("`%s' failed for library `%s' with error: %s\n"),
"lt_dlopenext",
- library_name, lt_dlerror ());
+ library_name,
+ lt_dlerror ());
return NULL;
}
plug = GNUNET_new (struct PluginList);
* @return whatever the shutdown function returned
*/
void *
-GNUNET_PLUGIN_unload (const char *library_name,
- void *arg)
+GNUNET_PLUGIN_unload (const char *library_name, void *arg)
{
struct PluginList *pos;
struct PluginList *prev;
libname = slashpos + 1;
n = strlen (libname);
if (0 != strncmp (lac->basename, libname, strlen (lac->basename)))
- return GNUNET_OK; /* wrong name */
+ return GNUNET_OK; /* wrong name */
if ((n > 3) && (0 == strcmp (&libname[n - 3], ".la")))
- return GNUNET_OK; /* .la file */
+ return GNUNET_OK; /* .la file */
basename = GNUNET_strdup (libname);
if (NULL != (dot = strstr (basename, ".")))
*dot = '\0';
* @param cb_cls closure for @a cb
*/
void
-GNUNET_PLUGIN_load_all (const char *basename, void *arg,
- GNUNET_PLUGIN_LoaderCallback cb, void *cb_cls)
+GNUNET_PLUGIN_load_all (const char *basename,
+ void *arg,
+ GNUNET_PLUGIN_LoaderCallback cb,
+ void *cb_cls)
{
struct LoadAllContext lac;
char *path;
if (NULL == path)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Could not determine plugin installation path.\n"));
+ _ ("Could not determine plugin installation path.\n"));
return;
}
lac.basename = basename;