diff options
Diffstat (limited to 'src/block/block.c')
-rw-r--r-- | src/block/block.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/block/block.c b/src/block/block.c index 582c13eb3..7c447f072 100644 --- a/src/block/block.c +++ b/src/block/block.c | |||
@@ -96,17 +96,14 @@ GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in, uint32_t mingle_number, | |||
96 | * @param lib_ret the plugin API | 96 | * @param lib_ret the plugin API |
97 | */ | 97 | */ |
98 | static void | 98 | static void |
99 | add_plugin (void *cls, | 99 | add_plugin (void *cls, const char *library_name, void *lib_ret) |
100 | const char *library_name, | ||
101 | void *lib_ret) | ||
102 | { | 100 | { |
103 | struct GNUNET_BLOCK_Context *ctx = cls; | 101 | struct GNUNET_BLOCK_Context *ctx = cls; |
104 | struct GNUNET_BLOCK_PluginFunctions *api = lib_ret; | 102 | struct GNUNET_BLOCK_PluginFunctions *api = lib_ret; |
105 | struct Plugin *plugin; | 103 | struct Plugin *plugin; |
106 | 104 | ||
107 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 105 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("Loading block plugin `%s'\n"), |
108 | _("Loading block plugin `%s'\n"), | 106 | library_name); |
109 | library_name); | ||
110 | plugin = GNUNET_malloc (sizeof (struct Plugin)); | 107 | plugin = GNUNET_malloc (sizeof (struct Plugin)); |
111 | plugin->api = api; | 108 | plugin->api = api; |
112 | plugin->library_name = GNUNET_strdup (library_name); | 109 | plugin->library_name = GNUNET_strdup (library_name); |
@@ -128,10 +125,7 @@ GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
128 | 125 | ||
129 | ctx = GNUNET_malloc (sizeof (struct GNUNET_BLOCK_Context)); | 126 | ctx = GNUNET_malloc (sizeof (struct GNUNET_BLOCK_Context)); |
130 | ctx->cfg = cfg; | 127 | ctx->cfg = cfg; |
131 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_block_", | 128 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_block_", NULL, &add_plugin, ctx); |
132 | NULL, | ||
133 | &add_plugin, | ||
134 | ctx); | ||
135 | return ctx; | 129 | return ctx; |
136 | } | 130 | } |
137 | 131 | ||
@@ -147,7 +141,7 @@ GNUNET_BLOCK_context_destroy (struct GNUNET_BLOCK_Context *ctx) | |||
147 | unsigned int i; | 141 | unsigned int i; |
148 | struct Plugin *plugin; | 142 | struct Plugin *plugin; |
149 | 143 | ||
150 | for (i = 0; i<ctx->num_plugins;i++) | 144 | for (i = 0; i < ctx->num_plugins; i++) |
151 | { | 145 | { |
152 | plugin = ctx->plugins[i]; | 146 | plugin = ctx->plugins[i]; |
153 | GNUNET_break (NULL == | 147 | GNUNET_break (NULL == |
@@ -174,7 +168,7 @@ find_plugin (struct GNUNET_BLOCK_Context *ctx, enum GNUNET_BLOCK_Type type) | |||
174 | unsigned int i; | 168 | unsigned int i; |
175 | unsigned int j; | 169 | unsigned int j; |
176 | 170 | ||
177 | for (i=0;i<ctx->num_plugins;i++) | 171 | for (i = 0; i < ctx->num_plugins; i++) |
178 | { | 172 | { |
179 | plugin = ctx->plugins[i]; | 173 | plugin = ctx->plugins[i]; |
180 | j = 0; | 174 | j = 0; |
@@ -291,8 +285,8 @@ compute_bloomfilter_size (unsigned int entry_count) | |||
291 | */ | 285 | */ |
292 | struct GNUNET_CONTAINER_BloomFilter * | 286 | struct GNUNET_CONTAINER_BloomFilter * |
293 | GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator, | 287 | GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator, |
294 | const GNUNET_HashCode *seen_results, | 288 | const GNUNET_HashCode * seen_results, |
295 | unsigned int seen_results_count) | 289 | unsigned int seen_results_count) |
296 | { | 290 | { |
297 | struct GNUNET_CONTAINER_BloomFilter *bf; | 291 | struct GNUNET_CONTAINER_BloomFilter *bf; |
298 | GNUNET_HashCode mhash; | 292 | GNUNET_HashCode mhash; |
@@ -300,7 +294,8 @@ GNUNET_BLOCK_construct_bloomfilter (int32_t bf_mutator, | |||
300 | size_t nsize; | 294 | size_t nsize; |
301 | 295 | ||
302 | nsize = compute_bloomfilter_size (seen_results_count); | 296 | nsize = compute_bloomfilter_size (seen_results_count); |
303 | bf = GNUNET_CONTAINER_bloomfilter_init (NULL, nsize, GNUNET_CONSTANTS_BLOOMFILTER_K); | 297 | bf = GNUNET_CONTAINER_bloomfilter_init (NULL, nsize, |
298 | GNUNET_CONSTANTS_BLOOMFILTER_K); | ||
304 | for (i = 0; i < seen_results_count; i++) | 299 | for (i = 0; i < seen_results_count; i++) |
305 | { | 300 | { |
306 | GNUNET_BLOCK_mingle_hash (&seen_results[i], bf_mutator, &mhash); | 301 | GNUNET_BLOCK_mingle_hash (&seen_results[i], bf_mutator, &mhash); |