From: Christian Grothoff Date: Sat, 7 Mar 2015 19:10:51 +0000 (+0000) Subject: -indentation and comment fixes X-Git-Tag: initial-import-from-subversion-38251~2230 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cd0ad4c559f9338eec2a152ded51d16e021eca06;p=oweals%2Fgnunet.git -indentation and comment fixes --- diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c index 5a46b2039..67ca9a8ad 100644 --- a/src/datastore/datastore_api.c +++ b/src/datastore/datastore_api.c @@ -1409,13 +1409,15 @@ GNUNET_DATASTORE_get_zero_anonymity (struct GNUNET_DATASTORE_Handle *h, * cancel */ struct GNUNET_DATASTORE_QueueEntry * -GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset, +GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, + uint64_t offset, const struct GNUNET_HashCode * key, enum GNUNET_BLOCK_Type type, unsigned int queue_priority, unsigned int max_queue_size, struct GNUNET_TIME_Relative timeout, - GNUNET_DATASTORE_DatumProcessor proc, void *proc_cls) + GNUNET_DATASTORE_DatumProcessor proc, + void *proc_cls) { struct GNUNET_DATASTORE_QueueEntry *qe; struct GetMessage *gm; @@ -1427,8 +1429,13 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset, (unsigned int) type, GNUNET_h2s (key)); qc.rc.proc = proc; qc.rc.proc_cls = proc_cls; - qe = make_queue_entry (h, sizeof (struct GetMessage), queue_priority, - max_queue_size, timeout, &process_result_message, &qc); + qe = make_queue_entry (h, + sizeof (struct GetMessage), + queue_priority, + max_queue_size, + timeout, + &process_result_message, + &qc); if (qe == NULL) { LOG (GNUNET_ERROR_TYPE_DEBUG, "Could not queue request for `%s'\n", @@ -1436,8 +1443,10 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h, uint64_t offset, return NULL; } #if INSANE_STATISTICS - GNUNET_STATISTICS_update (h->stats, gettext_noop ("# GET requests executed"), - 1, GNUNET_NO); + GNUNET_STATISTICS_update (h->stats, + gettext_noop ("# GET requests executed"), + 1, + GNUNET_NO); #endif gm = (struct GetMessage *) &qe[1]; gm->header.type = htons (GNUNET_MESSAGE_TYPE_DATASTORE_GET); diff --git a/src/fs/gnunet-service-fs_lc.c b/src/fs/gnunet-service-fs_lc.c index 2f19e3d5d..0e68718ac 100644 --- a/src/fs/gnunet-service-fs_lc.c +++ b/src/fs/gnunet-service-fs_lc.c @@ -327,7 +327,8 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, return GNUNET_SYSERR; } GNUNET_STATISTICS_update (GSF_stats, - gettext_noop ("# client searches received"), 1, + gettext_noop ("# client searches received"), + 1, GNUNET_NO); sc = (msize - sizeof (struct SearchMessage)) / sizeof (struct GNUNET_HashCode); sm = (const struct SearchMessage *) message; @@ -349,7 +350,9 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, (SEARCH_MESSAGE_OPTION_CONTINUED was always set) and that have a matching query and type */ if ((GNUNET_YES != prd->has_started) && - (0 != memcmp (&prd->query, &sm->query, sizeof (struct GNUNET_HashCode))) && + (0 != memcmp (&prd->query, + &sm->query, + sizeof (struct GNUNET_HashCode))) && (prd->type == type)) break; cr = cr->next; @@ -359,7 +362,9 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Have existing request, merging content-seen lists.\n"); - GSF_pending_request_update_ (cr->pr, (const struct GNUNET_HashCode *) &sm[1], sc); + GSF_pending_request_update_ (cr->pr, + (const struct GNUNET_HashCode *) &sm[1], + sc); GNUNET_STATISTICS_update (GSF_stats, gettext_noop ("# client searches updated (merged content seen list)"), @@ -372,7 +377,9 @@ GSF_local_client_start_search_handler_ (struct GNUNET_SERVER_Client *client, GNUNET_NO); cr = GNUNET_new (struct ClientRequest); cr->lc = lc; - GNUNET_CONTAINER_DLL_insert (lc->cr_head, lc->cr_tail, cr); + GNUNET_CONTAINER_DLL_insert (lc->cr_head, + lc->cr_tail, + cr); options = GSF_PRO_LOCAL_REQUEST; if (0 != (SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY & ntohl (sm->options))) options |= GSF_PRO_LOCAL_ONLY; diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 709874f75..c1ef6891c 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c @@ -1275,11 +1275,13 @@ warn_delay_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct GSF_PendingRequest *pr = cls; - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log (GNUNET_ERROR_TYPE_WARNING | GNUNET_ERROR_TYPE_BULK, _("Datastore lookup already took %s!\n"), - GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pr->qe_start), GNUNET_YES)); + GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pr->qe_start), + GNUNET_YES)); pr->warn_task = - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &warn_delay_task, + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, + &warn_delay_task, pr); } @@ -1514,10 +1516,10 @@ process_local_reply (void *cls, ((GNUNET_YES == GSF_test_get_load_too_high_ (0)) || (pr->public_data.results_found > 5 + 2 * pr->public_data.priority))) { - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Load too high, done with request\n"); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Load too high, done with request\n"); GNUNET_STATISTICS_update (GSF_stats, - gettext_noop - ("# Datastore lookups concluded (load too high)"), + gettext_noop ("# Datastore lookups concluded (load too high)"), 1, GNUNET_NO); goto check_error_and_continue; @@ -1626,7 +1628,8 @@ GSF_local_lookup_ (struct GSF_PendingRequest *pr, pr->llc_cont_cls = cont_cls; pr->qe_start = GNUNET_TIME_absolute_get (); pr->warn_task = - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, &warn_delay_task, + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MINUTES, + &warn_delay_task, pr); #if INSANE_STATISTICS GNUNET_STATISTICS_update (GSF_stats, diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 4dc869fd2..08b8c24f0 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c @@ -200,7 +200,8 @@ handle_query_message (void *cls, GNUNET_CRYPTO_hash (&qm->key, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), &hc); - res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, &hc); + res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, + &hc); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, (GNUNET_NO == res) ? "Received revocation check for valid key `%s' from client\n" @@ -215,7 +216,8 @@ handle_query_message (void *cls, client, &qrm.header, GNUNET_NO); - GNUNET_SERVER_receive_done (client, GNUNET_OK); + GNUNET_SERVER_receive_done (client, + GNUNET_OK); } @@ -237,10 +239,14 @@ do_flood (void *cls, struct GNUNET_MQ_Envelope *e; struct RevokeMessage *cp; - e = GNUNET_MQ_msg (cp, GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); + e = GNUNET_MQ_msg (cp, + GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); *cp = *rm; - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Flooding revocation to `%s'\n", GNUNET_i2s (target)); - GNUNET_MQ_send (pe->mq, e); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Flooding revocation to `%s'\n", + GNUNET_i2s (target)); + GNUNET_MQ_send (pe->mq, + e); return GNUNET_OK; } @@ -309,7 +315,8 @@ publicize_rm (const struct RevokeMessage *rm) if (GNUNET_OK != GNUNET_SET_add_element (revocation_set, &e, - NULL, NULL)) + NULL, + NULL)) { GNUNET_break (0); return GNUNET_OK; @@ -349,7 +356,8 @@ handle_revoke_message (void *cls, if (GNUNET_SYSERR == (ret = publicize_rm (rm))) { GNUNET_break_op (0); - GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); + GNUNET_SERVER_receive_done (client, + GNUNET_SYSERR); return; } rrm.header.size = htons (sizeof (struct RevocationResponseMessage)); @@ -361,7 +369,8 @@ handle_revoke_message (void *cls, client, &rrm.header, GNUNET_NO); - GNUNET_SERVER_receive_done (client, GNUNET_OK); + GNUNET_SERVER_receive_done (client, + GNUNET_OK); } @@ -387,7 +396,6 @@ handle_p2p_revoke_message (void *cls, } - /** * Callback for set operation results. Called for each element in the * result set. Each element contains a revocation, which we should @@ -416,7 +424,7 @@ add_revocation (void *cls, if (0 != element->element_type) { GNUNET_STATISTICS_update (stats, - "# unsupported revocations received via set union", + gettext_noop ("# unsupported revocations received via set union"), 1, GNUNET_NO); return; } @@ -425,7 +433,7 @@ add_revocation (void *cls, &peer_entry->id, &rm->header); GNUNET_STATISTICS_update (stats, - "# revocation messages received via set union", + gettext_noop ("# revocation messages received via set union"), 1, GNUNET_NO); break; case GNUNET_SET_STATUS_FAILURE: @@ -434,16 +442,18 @@ add_revocation (void *cls, GNUNET_i2s (&peer_entry->id)); peer_entry->so = NULL; GNUNET_STATISTICS_update (stats, - "# revocation set unions failed", - 1, GNUNET_NO); + gettext_noop ("# revocation set unions failed"), + 1, + GNUNET_NO); break; case GNUNET_SET_STATUS_HALF_DONE: break; case GNUNET_SET_STATUS_DONE: peer_entry->so = NULL; GNUNET_STATISTICS_update (stats, - "# revocation set unions completed", - 1, GNUNET_NO); + gettext_noop ("# revocation set unions completed"), + 1, + GNUNET_NO); break; default: GNUNET_break (0); @@ -502,7 +512,9 @@ handle_core_connect (void *cls, struct GNUNET_HashCode my_hash; struct GNUNET_HashCode peer_hash; - if (0 == memcmp(peer, &my_identity, sizeof (my_identity))) + if (0 == memcmp(peer, + &my_identity, + sizeof (my_identity))) return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -510,22 +522,21 @@ handle_core_connect (void *cls, GNUNET_i2s (peer)); peer_entry = GNUNET_CONTAINER_multipeermap_get (peers, peer); - if (NULL == peer_entry) - { - peer_entry = GNUNET_new (struct PeerEntry); - peer_entry->id = *peer; - GNUNET_assert (GNUNET_OK == - GNUNET_CONTAINER_multipeermap_put (peers, peer, - peer_entry, - GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); - } - else - { - GNUNET_assert (NULL == peer_entry->mq); - } + GNUNET_assert (NULL == peer_entry); + peer_entry = GNUNET_new (struct PeerEntry); + peer_entry->id = *peer; + GNUNET_assert (GNUNET_OK == + GNUNET_CONTAINER_multipeermap_put (peers, + &peer_entry->id, + peer_entry, + GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); peer_entry->mq = GNUNET_CORE_mq_create (core_api, peer); - GNUNET_CRYPTO_hash (&my_identity, sizeof (my_identity), &my_hash); - GNUNET_CRYPTO_hash (peer, sizeof (*peer), &peer_hash); + GNUNET_CRYPTO_hash (&my_identity, + sizeof (my_identity), + &my_hash); + GNUNET_CRYPTO_hash (peer, + sizeof (*peer), + &peer_hash); if (0 < GNUNET_CRYPTO_hash_cmp (&my_hash, &peer_hash)) { @@ -537,7 +548,10 @@ handle_core_connect (void *cls, &transmit_task_cb, peer_entry); } - GNUNET_STATISTICS_update (stats, "# peers connected", 1, GNUNET_NO); + GNUNET_STATISTICS_update (stats, + "# peers connected", + 1, + GNUNET_NO); } @@ -554,23 +568,23 @@ handle_core_disconnect (void *cls, { struct PeerEntry *pos; - if (0 == memcmp(peer, &my_identity, sizeof (my_identity))) - return; + if (0 == memcmp (peer, + &my_identity, + sizeof (my_identity))) + return; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Peer `%s' disconnected from us\n", GNUNET_i2s (peer)); - pos = GNUNET_CONTAINER_multipeermap_get (peers, peer); - if (NULL == pos) - { - GNUNET_break (0); - return; - } + pos = GNUNET_CONTAINER_multipeermap_get (peers, + peer); + GNUNET_assert (NULL != pos); GNUNET_assert (GNUNET_YES == - GNUNET_CONTAINER_multipeermap_remove (peers, peer, + GNUNET_CONTAINER_multipeermap_remove (peers, + peer, pos)); GNUNET_MQ_destroy (pos->mq); - if (pos->transmit_task != NULL) + if (NULL != pos->transmit_task) { GNUNET_SCHEDULER_cancel (pos->transmit_task); pos->transmit_task = NULL; @@ -581,7 +595,10 @@ handle_core_disconnect (void *cls, pos->so = NULL; } GNUNET_free (pos); - GNUNET_STATISTICS_update (stats, "# peers connected", -1, GNUNET_NO); + GNUNET_STATISTICS_update (stats, + "# peers connected", + -1, + GNUNET_NO); } @@ -855,9 +872,11 @@ run (void *cls, } GNUNET_free (fn); - GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, + GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, + &shutdown_task, NULL); - peers = GNUNET_CONTAINER_multipeermap_create (128, GNUNET_NO); + peers = GNUNET_CONTAINER_multipeermap_create (128, + GNUNET_YES); GNUNET_SERVER_add_handlers (srv, handlers); /* Connect to core service and register core handlers */ core_api = GNUNET_CORE_connect (cfg, /* Main configuration */ diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c index 5696f632c..2ca57ab6d 100644 --- a/src/set/gnunet-service-set_union.c +++ b/src/set/gnunet-service-set_union.c @@ -234,8 +234,7 @@ struct SetState * @param cls closure * @param key current key code * @param value value in the hash map - * @return #GNUNET_YES if we should continue to - * iterate, + * @return #GNUNET_YES if we should continue to iterate, * #GNUNET_NO if not. */ static int @@ -546,6 +545,7 @@ prepare_ibf (struct Operation *op, if (NULL == op->state->key_to_element) { unsigned int len; + len = GNUNET_CONTAINER_multihashmap_size (op->spec->set->elements); op->state->key_to_element = GNUNET_CONTAINER_multihashmap32_create (len + 1); GNUNET_CONTAINER_multihashmap_iterate (op->spec->set->elements, @@ -592,8 +592,9 @@ send_ibf (struct Operation *op, if (buckets_in_message > MAX_BUCKETS_PER_MESSAGE) buckets_in_message = MAX_BUCKETS_PER_MESSAGE; - ev = GNUNET_MQ_msg_extra (msg, buckets_in_message * IBF_BUCKET_SIZE, - GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF); + ev = GNUNET_MQ_msg_extra (msg, + buckets_in_message * IBF_BUCKET_SIZE, + GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF); msg->reserved = 0; msg->order = ibf_order; msg->offset = htons (buckets_sent); @@ -627,7 +628,8 @@ send_strata_estimator (struct Operation *op) SE_STRATA_COUNT * IBF_BUCKET_SIZE * SE_IBF_SIZE, GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE); strata_estimator_write (op->state->se, &strata_msg[1]); - GNUNET_MQ_send (op->mq, ev); + GNUNET_MQ_send (op->mq, + ev); op->state->phase = PHASE_EXPECT_IBF; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sent SE, expecting IBF\n"); @@ -1065,13 +1067,15 @@ send_remaining_elements (void *cls) struct GNUNET_MQ_Envelope *ev; struct GNUNET_SET_ResultMessage *rm; struct GNUNET_SET_Element *element; - element = &ke->element->element; + element = &ke->element->element; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "sending element (size %u) to client (full set)\n", element->size); GNUNET_assert (0 != op->spec->client_request_id); - ev = GNUNET_MQ_msg_extra (rm, element->size, GNUNET_MESSAGE_TYPE_SET_RESULT); + ev = GNUNET_MQ_msg_extra (rm, + element->size, + GNUNET_MESSAGE_TYPE_SET_RESULT); if (NULL == ev) { GNUNET_MQ_discard (ev); @@ -1280,7 +1284,8 @@ union_evaluate (struct Operation *op, } msg->operation = htonl (GNUNET_SET_OPERATION_UNION); msg->app_id = op->spec->app_id; - GNUNET_MQ_send (op->mq, ev); + GNUNET_MQ_send (op->mq, + ev); if (NULL != opaque_context) GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -1429,14 +1434,17 @@ union_peer_disconnect (struct Operation *op) struct GNUNET_MQ_Envelope *ev; struct GNUNET_SET_ResultMessage *msg; - ev = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SET_RESULT); + ev = GNUNET_MQ_msg (msg, + GNUNET_MESSAGE_TYPE_SET_RESULT); msg->request_id = htonl (op->spec->client_request_id); msg->result_status = htons (GNUNET_SET_STATUS_FAILURE); msg->element_type = htons (0); - GNUNET_MQ_send (op->spec->set->client_mq, ev); + GNUNET_MQ_send (op->spec->set->client_mq, + ev); GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "other peer disconnected prematurely\n"); - _GSS_operation_destroy (op, GNUNET_YES); + _GSS_operation_destroy (op, + GNUNET_YES); return; } // else: the session has already been concluded diff --git a/src/set/set_api.c b/src/set/set_api.c index 390d35e5f..ad46fe9db 100644 --- a/src/set/set_api.c +++ b/src/set/set_api.c @@ -324,7 +324,8 @@ handle_result (void *cls, { /* status is not #GNUNET_SET_STATUS_OK => there's no attached element, * and this is the last result message we get */ - GNUNET_MQ_assoc_remove (set->mq, ntohl (msg->request_id)); + GNUNET_MQ_assoc_remove (set->mq, + ntohl (msg->request_id)); GNUNET_CONTAINER_DLL_remove (set->ops_head, set->ops_tail, oh);