From d829597ee90dccffffd46a082372af6b35042130 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 9 Jan 2017 17:48:27 +0100 Subject: [PATCH] cosmetics --- src/dht/gnunet-service-dht_neighbours.c | 12 ++++++++---- src/dht/gnunet-service-dht_routing.c | 10 ++++++---- src/dht/plugin_block_dht.c | 12 +++++++----- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/src/dht/gnunet-service-dht_neighbours.c b/src/dht/gnunet-service-dht_neighbours.c index 574ed9ad0..0d3594d1a 100644 --- a/src/dht/gnunet-service-dht_neighbours.c +++ b/src/dht/gnunet-service-dht_neighbours.c @@ -1830,10 +1830,16 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender, /* first, check about our own HELLO */ if (NULL != GDS_my_hello) { - GNUNET_BLOCK_mingle_hash (&my_identity_hash, bf_mutator, &mhash); + GNUNET_BLOCK_mingle_hash (&my_identity_hash, + bf_mutator, + &mhash); if ((NULL == bf) || (GNUNET_YES != GNUNET_CONTAINER_bloomfilter_test (bf, &mhash))) { + size_t hello_size; + + hello_size = GNUNET_HELLO_size ((const struct GNUNET_HELLO_Message *) GDS_my_hello); + GNUNET_break (hello_size >= sizeof (struct GNUNET_MessageHeader)); GDS_NEIGHBOURS_handle_reply (sender, GNUNET_BLOCK_TYPE_DHT_HELLO, GNUNET_TIME_relative_to_absolute @@ -1844,9 +1850,7 @@ handle_find_peer (const struct GNUNET_PeerIdentity *sender, 0, NULL, GDS_my_hello, - GNUNET_HELLO_size ((const struct - GNUNET_HELLO_Message *) - GDS_my_hello)); + hello_size); } else { diff --git a/src/dht/gnunet-service-dht_routing.c b/src/dht/gnunet-service-dht_routing.c index 48bece35e..38e5fc1c7 100644 --- a/src/dht/gnunet-service-dht_routing.c +++ b/src/dht/gnunet-service-dht_routing.c @@ -183,15 +183,17 @@ process (void *cls, const struct GNUNET_HashCode * key, void *value) gpl = 0; ppl = 0; } - if ((0 != (rr->options & GNUNET_DHT_RO_FIND_PEER)) && - (pc->type == GNUNET_BLOCK_TYPE_DHT_HELLO)) + if ( (0 != (rr->options & GNUNET_DHT_RO_FIND_PEER)) && + (pc->type == GNUNET_BLOCK_TYPE_DHT_HELLO) ) { /* key may not match HELLO, which is OK since * the search is approximate. Still, the evaluation * would fail since the match is not exact. So * we fake it by changing the key to the actual PID ... */ - GNUNET_BLOCK_get_key (GDS_block_context, GNUNET_BLOCK_TYPE_DHT_HELLO, - pc->data, pc->data_size, &hc); + GNUNET_BLOCK_get_key (GDS_block_context, + GNUNET_BLOCK_TYPE_DHT_HELLO, + pc->data, pc->data_size, + &hc); eval_key = &hc; } else diff --git a/src/dht/plugin_block_dht.c b/src/dht/plugin_block_dht.c index 17594efcb..4256a0fe6 100644 --- a/src/dht/plugin_block_dht.c +++ b/src/dht/plugin_block_dht.c @@ -70,7 +70,7 @@ block_plugin_dht_evaluate (void *cls, if (type != GNUNET_BLOCK_TYPE_DHT_HELLO) return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; - if (xquery_size != 0) + if (0 != xquery_size) { GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; @@ -121,14 +121,16 @@ block_plugin_dht_evaluate (void *cls, * @param type block type * @param block block to get the key for * @param block_size number of bytes @a block - * @param key set to the key (query) for the given block + * @param[out] key set to the key (query) for the given block * @return #GNUNET_OK on success, #GNUNET_SYSERR if type not supported * (or if extracting a key from a block of this type does not work) */ static int -block_plugin_dht_get_key (void *cls, enum GNUNET_BLOCK_Type type, - const void *block, size_t block_size, - struct GNUNET_HashCode * key) +block_plugin_dht_get_key (void *cls, + enum GNUNET_BLOCK_Type type, + const void *block, + size_t block_size, + struct GNUNET_HashCode *key) { const struct GNUNET_MessageHeader *msg; const struct GNUNET_HELLO_Message *hello; -- 2.25.1