[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] branch master updated: -misc cleanups
From: |
gnunet |
Subject: |
[gnunet] branch master updated: -misc cleanups |
Date: |
Thu, 18 Aug 2022 15:41:32 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new ead0a3eec -misc cleanups
ead0a3eec is described below
commit ead0a3eec4d60193b1c157e74452ae888fddf2fb
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Thu Aug 18 15:41:28 2022 +0200
-misc cleanups
---
src/include/gnunet_container_lib.h | 68 +++++++++++++++++++++-----------------
src/util/plugin.c | 68 +++-----------------------------------
2 files changed, 42 insertions(+), 94 deletions(-)
diff --git a/src/include/gnunet_container_lib.h
b/src/include/gnunet_container_lib.h
index ae6c34f2b..93a88f239 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -766,7 +766,8 @@ enum GNUNET_CONTAINER_MultiHashMapOption
* iterate,
* #GNUNET_NO if not.
*/
-typedef int (*GNUNET_CONTAINER_MulitHashMapIteratorCallback) (
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_MulitHashMapIteratorCallback)(
void *cls,
const struct GNUNET_HashCode *key,
void *value);
@@ -834,7 +835,7 @@ GNUNET_CONTAINER_multihashmap_get (
* @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
* is not in the map
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap_remove (struct GNUNET_CONTAINER_MultiHashMap
*map,
const struct GNUNET_HashCode *key,
const void *value);
@@ -876,7 +877,7 @@ GNUNET_CONTAINER_multihashmap_clear (struct
GNUNET_CONTAINER_MultiHashMap *map);
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap_contains (
const struct GNUNET_CONTAINER_MultiHashMap *map,
const struct GNUNET_HashCode *key);
@@ -893,7 +894,7 @@ GNUNET_CONTAINER_multihashmap_contains (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap_contains_value (
const struct GNUNET_CONTAINER_MultiHashMap *map,
const struct GNUNET_HashCode *key,
@@ -913,7 +914,7 @@ GNUNET_CONTAINER_multihashmap_contains_value (
* #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
was the option and the
* value already exists
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap_put (
struct GNUNET_CONTAINER_MultiHashMap *map,
const struct GNUNET_HashCode *key,
@@ -982,7 +983,7 @@ GNUNET_CONTAINER_multihashmap_iterator_create (
* @return #GNUNET_YES we returned an element,
* #GNUNET_NO if we are out of elements
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap_iterator_next (
struct GNUNET_CONTAINER_MultiHashMapIterator *iter,
struct GNUNET_HashCode *key,
@@ -1050,7 +1051,8 @@ GNUNET_CONTAINER_multihashmap_get_random (
* iterate,
* #GNUNET_NO if not.
*/
-typedef int (*GNUNET_CONTAINER_PeerMapIterator) (
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_PeerMapIterator)(
void *cls,
const struct GNUNET_PeerIdentity *key,
void *value);
@@ -1123,7 +1125,7 @@ GNUNET_CONTAINER_multipeermap_get (
* @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
* is not in the map
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multipeermap_remove (struct GNUNET_CONTAINER_MultiPeerMap
*map,
const struct GNUNET_PeerIdentity *key,
const void *value);
@@ -1153,7 +1155,7 @@ GNUNET_CONTAINER_multipeermap_remove_all (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multipeermap_contains (
const struct GNUNET_CONTAINER_MultiPeerMap *map,
const struct GNUNET_PeerIdentity *key);
@@ -1170,7 +1172,7 @@ GNUNET_CONTAINER_multipeermap_contains (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multipeermap_contains_value (
const struct GNUNET_CONTAINER_MultiPeerMap *map,
const struct GNUNET_PeerIdentity *key,
@@ -1261,7 +1263,7 @@ GNUNET_CONTAINER_multipeermap_iterator_create (
* @return #GNUNET_YES we returned an element,
* #GNUNET_NO if we are out of elements
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multipeermap_iterator_next (
struct GNUNET_CONTAINER_MultiPeerMapIterator *iter,
struct GNUNET_PeerIdentity *key,
@@ -1329,7 +1331,8 @@ GNUNET_CONTAINER_multipeermap_get_random (
* iterate,
* #GNUNET_NO if not.
*/
-typedef int (*GNUNET_CONTAINER_ShortmapIterator) (
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_ShortmapIterator)(
void *cls,
const struct GNUNET_ShortHashCode *key,
void *value);
@@ -1470,7 +1473,7 @@ GNUNET_CONTAINER_multishortmap_contains_value (
* #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
was the option and the
* value already exists
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multishortmap_put (
struct GNUNET_CONTAINER_MultiShortmap *map,
const struct GNUNET_ShortHashCode *key,
@@ -1543,7 +1546,7 @@ GNUNET_CONTAINER_multishortmap_iterator_create (
* @return #GNUNET_YES we returned an element,
* #GNUNET_NO if we are out of elements
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multishortmap_iterator_next (
struct GNUNET_CONTAINER_MultiShortmapIterator *iter,
struct GNUNET_ShortHashCode *key,
@@ -1612,7 +1615,8 @@ GNUNET_CONTAINER_multishortmap_get_random (
* iterate,
* #GNUNET_NO if not.
*/
-typedef int (*GNUNET_CONTAINER_MultiUuidmapIteratorCallback) (
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_MultiUuidmapIteratorCallback)(
void *cls,
const struct GNUNET_Uuid *key,
void *value);
@@ -1685,7 +1689,7 @@ GNUNET_CONTAINER_multiuuidmap_get (
* @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
* is not in the map
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multiuuidmap_remove (struct GNUNET_CONTAINER_MultiUuidmap
*map,
const struct GNUNET_Uuid *key,
const void *value);
@@ -1715,7 +1719,7 @@ GNUNET_CONTAINER_multiuuidmap_remove_all (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multiuuidmap_contains (
const struct GNUNET_CONTAINER_MultiUuidmap *map,
const struct GNUNET_Uuid *key);
@@ -1732,7 +1736,7 @@ GNUNET_CONTAINER_multiuuidmap_contains (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multiuuidmap_contains_value (
const struct GNUNET_CONTAINER_MultiUuidmap *map,
const struct GNUNET_Uuid *key,
@@ -1752,7 +1756,7 @@ GNUNET_CONTAINER_multiuuidmap_contains_value (
* #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
was the option and the
* value already exists
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multiuuidmap_put (
struct GNUNET_CONTAINER_MultiUuidmap *map,
const struct GNUNET_Uuid *key,
@@ -1825,7 +1829,7 @@ GNUNET_CONTAINER_multiuuidmap_iterator_create (
* @return #GNUNET_YES we returned an element,
* #GNUNET_NO if we are out of elements
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multiuuidmap_iterator_next (
struct GNUNET_CONTAINER_MultiUuidmapIterator *iter,
struct GNUNET_Uuid *key,
@@ -1908,9 +1912,11 @@ struct GNUNET_CONTAINER_MultiHashMap32Iterator;
* iterate,
* #GNUNET_NO if not.
*/
-typedef int (*GNUNET_CONTAINER_MulitHashMapIterator32Callback) (void *cls,
- uint32_t key,
- void *value);
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_MulitHashMapIterator32Callback)(
+ void *cls,
+ uint32_t key,
+ void *value);
/**
@@ -1994,7 +2000,7 @@ GNUNET_CONTAINER_multihashmap32_iterate (
* @return #GNUNET_YES on success, #GNUNET_NO if the key-value pair
* is not in the map
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap32_remove (
struct GNUNET_CONTAINER_MultiHashMap32 *map,
uint32_t key,
@@ -2026,7 +2032,7 @@ GNUNET_CONTAINER_multihashmap32_remove_all (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap32_contains (
const struct GNUNET_CONTAINER_MultiHashMap32 *map,
uint32_t key);
@@ -2043,7 +2049,7 @@ GNUNET_CONTAINER_multihashmap32_contains (
* @return #GNUNET_YES if such a value exists,
* #GNUNET_NO if not
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap32_contains_value (
const struct GNUNET_CONTAINER_MultiHashMap32 *map,
uint32_t key,
@@ -2063,7 +2069,7 @@ GNUNET_CONTAINER_multihashmap32_contains_value (
* #GNUNET_SYSERR if #GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
was the option and the
* value already exists
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap32_put (
struct GNUNET_CONTAINER_MultiHashMap32 *map,
uint32_t key,
@@ -2121,7 +2127,7 @@ GNUNET_CONTAINER_multihashmap32_iterator_create (
* @return #GNUNET_YES we returned an element,
* #GNUNET_NO if we are out of elements
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_multihashmap32_iterator_next (
struct GNUNET_CONTAINER_MultiHashMap32Iterator *iter,
uint32_t *key,
@@ -2568,7 +2574,7 @@ GNUNET_CONTAINER_heap_peek (const struct
GNUNET_CONTAINER_Heap *heap);
* @return #GNUNET_YES if an element is returned,
* #GNUNET_NO if the heap is empty.
*/
-int
+enum GNUNET_GenericReturnValue
GNUNET_CONTAINER_heap_peek2 (const struct GNUNET_CONTAINER_Heap *heap,
void **element,
GNUNET_CONTAINER_HeapCostType *cost);
@@ -2608,8 +2614,8 @@ GNUNET_CONTAINER_heap_node_get_cost (
* @return #GNUNET_YES if we should continue to iterate,
* #GNUNET_NO if not.
*/
-typedef int
-(*GNUNET_CONTAINER_HeapIterator) (
+typedef enum GNUNET_GenericReturnValue
+(*GNUNET_CONTAINER_HeapIterator)(
void *cls,
struct GNUNET_CONTAINER_HeapNode *node,
void *element,
diff --git a/src/util/plugin.c b/src/util/plugin.c
index 6ee41eec9..ffbae06ff 100644
--- a/src/util/plugin.c
+++ b/src/util/plugin.c
@@ -124,7 +124,8 @@ plugin_fini (void)
GNUNET_free (old_dlsearchpath);
old_dlsearchpath = NULL;
}
- lt_dlexit ();
+ if (NULL == getenv ("VALGRINDING_PLUGINS"))
+ lt_dlexit ();
}
@@ -162,16 +163,7 @@ resolve_function (struct PluginList *plug,
}
-/**
- * Test if a plugin exists.
- *
- * Note that the library must export a symbol called
- * `library_name_init` for the test to succeed.
- *
- * @param library_name name of the plugin to test if it is installed
- * @return #GNUNET_YES if the plugin exists, #GNUNET_NO if not
- */
-int
+enum GNUNET_GenericReturnValue
GNUNET_PLUGIN_test (const char *library_name)
{
void *libhandle;
@@ -201,18 +193,6 @@ GNUNET_PLUGIN_test (const char *library_name)
}
-/**
- * Setup plugin (runs the `init` callback and returns whatever `init`
- * returned). If `init` returns NULL, the plugin is unloaded.
- *
- * Note that the library must export symbols called
- * `library_name_init` and `library_name_done`. These will be called
- * when the library is loaded and unloaded respectively.
- *
- * @param library_name name of the plugin to load
- * @param arg argument to the plugin initialization function
- * @return whatever the initialization function returned
- */
void *
GNUNET_PLUGIN_load (const char *library_name,
void *arg)
@@ -257,14 +237,6 @@ GNUNET_PLUGIN_load (const char *library_name,
}
-/**
- * Unload plugin (runs the `done` callback and returns whatever `done`
- * returned). The plugin is then unloaded.
- *
- * @param library_name name of the plugin to unload
- * @param arg argument to the plugin shutdown function
- * @return whatever the shutdown function returned
- */
void *
GNUNET_PLUGIN_unload (const char *library_name,
void *arg)
@@ -295,7 +267,8 @@ GNUNET_PLUGIN_unload (const char *library_name,
prev->next = pos->next;
if (NULL != done)
ret = done (arg);
- lt_dlclose (pos->handle);
+ if (NULL == getenv ("VALGRINDING_PLUGINS"))
+ lt_dlclose (pos->handle);
GNUNET_free (pos->name);
GNUNET_free (pos);
if (NULL == plugins)
@@ -381,23 +354,6 @@ find_libraries (void *cls,
}
-/**
- * Load all compatible plugins with the given base name.
- *
- * Note that the library must export symbols called
- * `basename_ANYTHING_init` and `basename_ANYTHING__done`. These will
- * be called when the library is loaded and unloaded respectively.
- *
- * If you are writing a service to which third-party applications can connect,
- * like GNUnet's own GNS service for example, you should use
- * #GNUNET_PLUGIN_load_all_in_context instead of this function, passing your
- * service's project data as context.
- *
- * @param basename basename of the plugins to load
- * @param arg argument to the plugin initialization function
- * @param cb function to call for each plugin found
- * @param cb_cls closure for @a cb
- */
void
GNUNET_PLUGIN_load_all (const char *basename,
void *arg,
@@ -425,20 +381,6 @@ GNUNET_PLUGIN_load_all (const char *basename,
}
-/**
- * Load all compatible plugins with the given base name while inside the given
- * context (i.e. a specific project data structure.)
- *
- * Note that the library must export symbols called `basename_ANYTHING_init`
- * and `basename_ANYTHING__done`. These will be called when the library is
- * loaded and unloaded respectively.
- *
- * @param ctx the context used to find the plugins
- * @param basename basename of the plugins to load
- * @param arg argument to the plugin initialization function
- * @param cb function to call for each plugin found
- * @param cb_cls closure for @a cb
- */
void
GNUNET_PLUGIN_load_all_in_context (const struct GNUNET_OS_ProjectData *ctx,
const char *basename,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet] branch master updated: -misc cleanups,
gnunet <=