From 28ab2c446fba4980a8295d59fdf203a028a35dd6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 17 Jul 2020 22:35:36 +0200 Subject: avoid boolean flag in GNUNET_OS_start_process() API (fixes #6188) --- src/transport/transport-testing2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/transport/transport-testing2.c') diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c index 0dc1bb331..2a7a1dfcb 100644 --- a/src/transport/transport-testing2.c +++ b/src/transport/transport-testing2.c @@ -915,8 +915,8 @@ communicator_start ( LOG (GNUNET_ERROR_TYPE_DEBUG, "communicator_start\n"); binary = GNUNET_OS_get_libexec_binary_path (binary_name); - tc_h->c_proc = GNUNET_OS_start_process (GNUNET_YES, - GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + tc_h->c_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR + | GNUNET_OS_USE_PIPE_CONTROL, NULL, NULL, NULL, @@ -967,8 +967,8 @@ resolver_start (struct LOG (GNUNET_ERROR_TYPE_DEBUG, "resolver_start\n"); binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); - tc_h->resolver_proc = GNUNET_OS_start_process (GNUNET_YES, - GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + tc_h->resolver_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR + | GNUNET_OS_USE_PIPE_CONTROL, NULL, NULL, NULL, @@ -999,8 +999,8 @@ nat_start ( LOG (GNUNET_ERROR_TYPE_DEBUG, "nat_start\n"); binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-nat"); - tc_h->nat_proc = GNUNET_OS_start_process (GNUNET_YES, - GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + tc_h->nat_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR + | GNUNET_OS_USE_PIPE_CONTROL, NULL, NULL, NULL, -- cgit v1.2.3 From 7f4ddbcab8598e3d5e29c23ce883cdfa664408f1 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 18 Jul 2020 00:44:39 +0200 Subject: merge flags into enum for GNUNET_DISK_pipe() API, fixing #6188 --- src/abd/gnunet-abd.c | 31 ++++--- src/abd/plugin_gnsrecord_abd.c | 3 +- src/arm/arm_api.c | 5 +- src/arm/gnunet-service-arm.c | 33 ++++--- src/cadet/cadet.h | 4 +- src/cadet/cadet_api.c | 4 +- src/cadet/cadet_api_drop_message.c | 16 ++-- src/cadet/cadet_protocol.h | 4 +- src/cadet/gnunet-service-cadet.c | 100 +++++++++++---------- src/cadet/gnunet-service-cadet.h | 1 - src/cadet/gnunet-service-cadet_channel.c | 28 +++--- src/cadet/gnunet-service-cadet_connection.c | 3 +- src/cadet/gnunet-service-cadet_core.c | 6 +- src/cadet/gnunet-service-cadet_peer.c | 2 + src/cadet/gnunet-service-cadet_tunnels.c | 2 +- src/cadet/gnunet-service-cadet_tunnels.h | 2 +- src/cadet/test_cadet.c | 11 ++- src/conversation/test_conversation_api.c | 6 +- src/conversation/test_conversation_api_reject.c | 6 +- src/conversation/test_conversation_api_twocalls.c | 6 +- src/curl/curl.c | 8 +- src/fs/fs_namespace.c | 22 ++--- src/fs/gnunet-auto-share.c | 11 +-- src/gns/gns_api.c | 1 + src/gns/gnunet-dns2gns.c | 2 + src/gns/nss/nss_gns.c | 2 +- src/gns/nss/nss_gns_query.c | 2 +- src/gnsrecord/gnsrecord.c | 8 +- src/hostlist/gnunet-daemon-hostlist_client.c | 20 +++-- src/identity/gnunet-identity.c | 6 +- src/identity/plugin_rest_identity.c | 3 +- src/include/gnunet_bio_lib.h | 35 ++++---- src/include/gnunet_buffer_lib.h | 2 +- src/include/gnunet_common.h | 38 ++++---- src/include/gnunet_configuration_lib.h | 2 +- src/include/gnunet_constants.h | 3 +- src/include/gnunet_container_lib.h | 52 +++++------ src/include/gnunet_curl_lib.h | 2 +- src/include/gnunet_disk_lib.h | 46 +++++++--- src/include/gnunet_mq_lib.h | 6 +- src/include/gnunet_reclaim_lib.h | 2 +- src/include/gnunet_reclaim_plugin.h | 6 +- src/include/gnunet_reclaim_service.h | 6 +- src/include/platform.h | 4 +- src/json/json_generator.c | 4 +- src/json/json_gnsrecord.c | 4 +- src/namestore/gnunet-namestore.c | 3 +- src/namestore/gnunet-service-namestore.c | 2 +- src/namestore/plugin_rest_namestore.c | 54 ++++++----- src/nat/gnunet-service-nat_helper.c | 2 +- src/nat/gnunet-service-nat_mini.c | 2 +- src/reclaim/gnunet-service-reclaim_tickets.c | 2 +- src/reclaim/json_reclaim.h | 1 - src/reclaim/plugin_reclaim_attribute_basic.c | 1 + src/reclaim/plugin_rest_reclaim.c | 5 +- src/reclaim/reclaim_attestation.c | 2 +- src/reclaim/reclaim_attribute.c | 3 +- src/revocation/gnunet-revocation-tvg.c | 19 ++-- src/revocation/revocation_api.c | 8 +- src/rps/gnunet-rps-profiler.c | 6 +- src/rps/test_rps.c | 6 +- src/set/gnunet-service-set_intersection.c | 2 +- .../gnunet-service-set_union_strata_estimator.c | 4 +- src/statistics/gnunet-service-statistics.c | 3 +- src/testbed/generate-underlay-topology.c | 12 +-- src/testbed/gnunet-daemon-latency-logger.c | 4 +- src/testbed/gnunet-daemon-testbed-underlay.c | 4 +- src/testbed/gnunet-helper-testbed.c | 2 +- src/testbed/gnunet-service-testbed.h | 2 +- src/testbed/gnunet_testbed_mpi_spawn.c | 3 +- src/testbed/test_testbed_api.c | 2 +- src/testbed/test_testbed_api_2peers_1controller.c | 2 +- src/testbed/test_testbed_api_controllerlink.c | 2 +- .../test_testbed_api_peer_reconfiguration.c | 2 +- .../test_testbed_api_peers_manage_services.c | 2 +- src/testbed/test_testbed_api_statistics.c | 2 +- src/testbed/test_testbed_api_test.c | 4 +- src/testbed/testbed_api_hosts.c | 2 +- src/transport/gnunet-communicator-tcp.c | 19 +++- src/transport/gnunet-communicator-udp.c | 3 +- src/transport/gnunet-communicator-unix.c | 5 +- src/transport/plugin_transport_smtp.c | 6 +- src/transport/test_communicator_basic.c | 54 +++++------ src/transport/transport-testing2.c | 28 +++--- src/transport/transport.h | 1 - src/transport/transport_api2_communication.c | 3 +- src/util/bio.c | 41 ++++----- src/util/configuration.c | 7 +- src/util/crypto_ecc.c | 10 +-- src/util/crypto_hash.c | 4 +- src/util/crypto_mpi.c | 4 +- src/util/disk.c | 44 ++++----- src/util/gnunet-qr.c | 7 +- src/util/gnunet-uri.c | 2 +- src/util/helper.c | 7 +- src/util/os_priority.c | 4 +- src/util/perf_malloc.c | 4 +- src/util/perf_scheduler.c | 4 +- src/util/scheduler.c | 5 +- src/util/service.c | 4 +- src/util/strings.c | 2 +- src/util/test_bio.c | 14 +-- src/util/test_common_logging_runtime_loglevels.c | 5 +- src/util/test_container_multihashmap.c | 2 +- src/util/test_container_multipeermap.c | 2 +- src/util/test_scheduler.c | 2 +- 106 files changed, 556 insertions(+), 477 deletions(-) (limited to 'src/transport/transport-testing2.c') diff --git a/src/abd/gnunet-abd.c b/src/abd/gnunet-abd.c index 963d9207a..ff7dd09c5 100644 --- a/src/abd/gnunet-abd.c +++ b/src/abd/gnunet-abd.c @@ -513,8 +513,8 @@ get_existing_record (void *cls, const struct GNUNET_GNSRECORD_Data *rd) { struct GNUNET_GNSRECORD_Data *rde; - struct GNUNET_GNSRECORD_Data* rdn = - GNUNET_malloc(sizeof(*rdn)*(rd_count + 1)); + struct GNUNET_GNSRECORD_Data*rdn = + GNUNET_malloc (sizeof(*rdn) * (rd_count + 1)); memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data)); GNUNET_memcpy (&rdn[1], rd, @@ -541,7 +541,7 @@ get_existing_record (void *cls, rde, &add_continuation, &add_qe); - GNUNET_free(rdn); + GNUNET_free (rdn); return; } @@ -604,13 +604,18 @@ store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) if (GNUNET_OK != GNUNET_GNSRECORD_string_to_value (type, subject, &data, &data_size)) { - if(typestring == NULL) { - fputs("No value for unknown record type\n", stderr); - } else if(subject == NULL) { - fprintf(stderr, - "No value for record type`%s'\n", - typestring); - } else { + if (typestring == NULL) + { + fputs ("No value for unknown record type\n", stderr); + } + else if (subject == NULL) + { + fprintf (stderr, + "No value for record type`%s'\n", + typestring); + } + else + { fprintf (stderr, "Value `%s' invalid for record type `%s'\n", subject, @@ -927,8 +932,8 @@ run (void *cls, int i; while (NULL != (tok = strtok (NULL, ","))) count++; - struct GNUNET_ABD_Delegate* delegates = - GNUNET_malloc(sizeof(*delegates)*count); + struct GNUNET_ABD_Delegate*delegates = + GNUNET_malloc (sizeof(*delegates) * count); struct GNUNET_ABD_Delegate *dele; GNUNET_free (tmp); tmp = GNUNET_strdup (subject_delegate); @@ -961,7 +966,7 @@ run (void *cls, delegates[i].issuer_attribute = NULL; } GNUNET_free (tmp); - GNUNET_free(delegates); + GNUNET_free (delegates); } else { diff --git a/src/abd/plugin_gnsrecord_abd.c b/src/abd/plugin_gnsrecord_abd.c index 850fa9a45..272872e24 100644 --- a/src/abd/plugin_gnsrecord_abd.c +++ b/src/abd/plugin_gnsrecord_abd.c @@ -235,7 +235,8 @@ abd_string_to_value (void *cls, (char *) &sets[1]); for (i = 0; i < entries; i++) { - if (0 != set[i].subject_attribute_len) { + if (0 != set[i].subject_attribute_len) + { GNUNET_free_nz ((char *) set[i].subject_attribute); set[i].subject_attribute = NULL; } diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index dea7a70be..899b6f152 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c @@ -972,10 +972,7 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, the above check should catch 99.99% of the cases where ARM is already running. */LOG (GNUNET_ERROR_TYPE_DEBUG, "Starting ARM service\n"); - if (NULL == (sig = GNUNET_DISK_pipe (GNUNET_NO, - GNUNET_NO, - GNUNET_NO, - GNUNET_YES))) + if (NULL == (sig = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE))) { GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING, "pipe"); diff --git a/src/arm/gnunet-service-arm.c b/src/arm/gnunet-service-arm.c index 00b6e7196..263c99cc4 100644 --- a/src/arm/gnunet-service-arm.c +++ b/src/arm/gnunet-service-arm.c @@ -859,7 +859,8 @@ start_process (struct ServiceList *sl, if (NULL != options) options = GNUNET_CONFIGURATION_expand_dollar (cfg, options); sl->proc = GNUNET_OS_start_process_s (sl->pipe_control - ? GNUNET_OS_INHERIT_STD_OUT_AND_ERR | GNUNET_OS_USE_PIPE_CONTROL + ? GNUNET_OS_INHERIT_STD_OUT_AND_ERR + | GNUNET_OS_USE_PIPE_CONTROL : GNUNET_OS_INHERIT_STD_OUT_AND_ERR, lsocks, loprefix, @@ -882,8 +883,11 @@ start_process (struct ServiceList *sl, { if (NULL == sl->config) sl->proc = GNUNET_OS_start_process_s (sl->pipe_control - ? GNUNET_OS_INHERIT_STD_OUT_AND_ERR | GNUNET_OS_USE_PIPE_CONTROL - : GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + ? + GNUNET_OS_INHERIT_STD_OUT_AND_ERR + | GNUNET_OS_USE_PIPE_CONTROL + : + GNUNET_OS_INHERIT_STD_OUT_AND_ERR, lsocks, loprefix, quotedbinary, @@ -893,8 +897,11 @@ start_process (struct ServiceList *sl, NULL); else sl->proc = GNUNET_OS_start_process_s (sl->pipe_control - ? GNUNET_OS_INHERIT_STD_OUT_AND_ERR | GNUNET_OS_USE_PIPE_CONTROL - : GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + ? + GNUNET_OS_INHERIT_STD_OUT_AND_ERR + | GNUNET_OS_USE_PIPE_CONTROL + : + GNUNET_OS_INHERIT_STD_OUT_AND_ERR, lsocks, loprefix, quotedbinary, @@ -909,8 +916,11 @@ start_process (struct ServiceList *sl, { if (NULL == sl->config) sl->proc = GNUNET_OS_start_process_s (sl->pipe_control - ? GNUNET_OS_INHERIT_STD_OUT_AND_ERR | GNUNET_OS_USE_PIPE_CONTROL - : GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + ? + GNUNET_OS_INHERIT_STD_OUT_AND_ERR + | GNUNET_OS_USE_PIPE_CONTROL + : + GNUNET_OS_INHERIT_STD_OUT_AND_ERR, lsocks, loprefix, quotedbinary, @@ -918,8 +928,11 @@ start_process (struct ServiceList *sl, NULL); else sl->proc = GNUNET_OS_start_process_s (sl->pipe_control - ? GNUNET_OS_INHERIT_STD_OUT_AND_ERR | GNUNET_OS_USE_PIPE_CONTROL - : GNUNET_OS_INHERIT_STD_OUT_AND_ERR, + ? + GNUNET_OS_INHERIT_STD_OUT_AND_ERR + | GNUNET_OS_USE_PIPE_CONTROL + : + GNUNET_OS_INHERIT_STD_OUT_AND_ERR, lsocks, loprefix, quotedbinary, @@ -2157,7 +2170,7 @@ main (int argc, char *const *argv) GNUNET_MQ_handler_end () }; - sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO); + sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE); GNUNET_assert (NULL != sigpipe); shc_chld = GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, diff --git a/src/cadet/cadet.h b/src/cadet/cadet.h index d17eab1d6..31dad4117 100644 --- a/src/cadet/cadet.h +++ b/src/cadet/cadet.h @@ -325,7 +325,7 @@ struct GNUNET_CADET_RequestDropCadetMessage * Type: #GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE */ struct GNUNET_MessageHeader header; - + /** * Type of the message this handler covers, in host byte order. */ @@ -337,7 +337,7 @@ struct GNUNET_CADET_RequestDropCadetMessage struct GNUNET_CADET_ClientChannelNumber ccn; }; - + /** * Message to inform the client about channels in the service. */ diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 67f6571c5..45cc508a6 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c @@ -1001,8 +1001,8 @@ GNUNET_CADET_open_port (struct GNUNET_CADET_Handle *h, p->window_changes = window_changes; p->disconnects = disconnects; p->handlers = (NULL == pd->agpl_url) - ? GNUNET_MQ_copy_handlers (handlers) - : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL); + ? GNUNET_MQ_copy_handlers (handlers) + : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL); GNUNET_assert (GNUNET_OK == open_port_cb (h, &p->id, p)); return p; diff --git a/src/cadet/cadet_api_drop_message.c b/src/cadet/cadet_api_drop_message.c index d9f7e003e..2b031b5c0 100644 --- a/src/cadet/cadet_api_drop_message.c +++ b/src/cadet/cadet_api_drop_message.c @@ -11,7 +11,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. - + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . @@ -35,8 +35,8 @@ */ void GNUNET_CADET_drop_message (struct GNUNET_MQ_Handle *mq, - struct GNUNET_CADET_ClientChannelNumber ccn, - uint16_t type) + struct GNUNET_CADET_ClientChannelNumber ccn, + uint16_t type) { struct GNUNET_CADET_RequestDropCadetMessage *message; struct GNUNET_MQ_Envelope *env; @@ -45,15 +45,15 @@ GNUNET_CADET_drop_message (struct GNUNET_MQ_Handle *mq, message->ccn = ccn; message->type = type; - + GNUNET_log (GNUNET_ERROR_TYPE_INFO, - "Dropping message for channel of type %s (%d)\n", type == GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY ? "GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY" : "UNKNOWN", type); + "Dropping message for channel of type %s (%d)\n", type == + GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY ? + "GNUNET_MESSAGE_TYPE_CADET_CHANNEL_DESTROY" : "UNKNOWN", type); GNUNET_MQ_send (mq, env); - -} - +} /* end of cadet_api_drop_message.c */ diff --git a/src/cadet/cadet_protocol.h b/src/cadet/cadet_protocol.h index 08298e224..117a7922e 100644 --- a/src/cadet/cadet_protocol.h +++ b/src/cadet/cadet_protocol.h @@ -85,11 +85,11 @@ struct GNUNET_CADET_ConnectionCreateMessage uint32_t options GNUNET_PACKED; /** - * This flag indicates the peer sending the connection create + * This flag indicates the peer sending the connection create * meassage likes to trigger a KX handshake. */ int has_monotime; - + /** * This monotonic time is set, if a peer likes to trigger a KX, but is not * the peer that should start the KX. (xrs,t3ss) diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c index f3767fb01..2d3b548dd 100644 --- a/src/cadet/gnunet-service-cadet.c +++ b/src/cadet/gnunet-service-cadet.c @@ -1010,6 +1010,7 @@ handle_info_tunnels (void *cls, GNUNET_SERVICE_client_continue (c->client); } + /** * Handler for client's #GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE request. * @@ -1026,11 +1027,12 @@ handle_drop_message (void *cls, ch = lookup_channel (c, message->ccn); - GCCH_assign_type_to_drop(ch, message); - + GCCH_assign_type_to_drop (ch, message); + GNUNET_SERVICE_client_continue (c->client); } + /** * Callback called when a client connects to the service. * @@ -1327,52 +1329,52 @@ run (void *cls, * Define "main" method using service macro. */ GNUNET_SERVICE_MAIN -("cadet", - GNUNET_SERVICE_OPTION_NONE, - &run, - &client_connect_cb, - &client_disconnect_cb, - NULL, - GNUNET_MQ_hd_fixed_size (port_open, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN, - struct GNUNET_CADET_PortMessage, - NULL), - GNUNET_MQ_hd_fixed_size (port_close, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE, - struct GNUNET_CADET_PortMessage, - NULL), - GNUNET_MQ_hd_fixed_size (channel_create, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE, - struct GNUNET_CADET_LocalChannelCreateMessage, - NULL), - GNUNET_MQ_hd_fixed_size (channel_destroy, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY, - struct GNUNET_CADET_LocalChannelDestroyMessage, - NULL), - GNUNET_MQ_hd_var_size (local_data, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, - struct GNUNET_CADET_LocalData, - NULL), - GNUNET_MQ_hd_fixed_size (local_ack, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK, - struct GNUNET_CADET_LocalAck, - NULL), - GNUNET_MQ_hd_fixed_size (get_peers, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PEERS, - struct GNUNET_MessageHeader, - NULL), - GNUNET_MQ_hd_fixed_size (show_path, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH, - struct GNUNET_CADET_RequestPathInfoMessage, - NULL), - GNUNET_MQ_hd_fixed_size (info_tunnels, - GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS, - struct GNUNET_MessageHeader, - NULL), - GNUNET_MQ_hd_fixed_size (drop_message, - GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE, - struct GNUNET_CADET_RequestDropCadetMessage, - NULL), - GNUNET_MQ_handler_end ()); + ("cadet", + GNUNET_SERVICE_OPTION_NONE, + &run, + &client_connect_cb, + &client_disconnect_cb, + NULL, + GNUNET_MQ_hd_fixed_size (port_open, + GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_OPEN, + struct GNUNET_CADET_PortMessage, + NULL), + GNUNET_MQ_hd_fixed_size (port_close, + GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE, + struct GNUNET_CADET_PortMessage, + NULL), + GNUNET_MQ_hd_fixed_size (channel_create, + GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_CREATE, + struct GNUNET_CADET_LocalChannelCreateMessage, + NULL), + GNUNET_MQ_hd_fixed_size (channel_destroy, + GNUNET_MESSAGE_TYPE_CADET_LOCAL_CHANNEL_DESTROY, + struct GNUNET_CADET_LocalChannelDestroyMessage, + NULL), + GNUNET_MQ_hd_var_size (local_data, + GNUNET_MESSAGE_TYPE_CADET_LOCAL_DATA, + struct GNUNET_CADET_LocalData, + NULL), + GNUNET_MQ_hd_fixed_size (local_ack, + GNUNET_MESSAGE_TYPE_CADET_LOCAL_ACK, + struct GNUNET_CADET_LocalAck, + NULL), + GNUNET_MQ_hd_fixed_size (get_peers, + GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PEERS, + struct GNUNET_MessageHeader, + NULL), + GNUNET_MQ_hd_fixed_size (show_path, + GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_PATH, + struct GNUNET_CADET_RequestPathInfoMessage, + NULL), + GNUNET_MQ_hd_fixed_size (info_tunnels, + GNUNET_MESSAGE_TYPE_CADET_LOCAL_REQUEST_INFO_TUNNELS, + struct GNUNET_MessageHeader, + NULL), + GNUNET_MQ_hd_fixed_size (drop_message, + GNUNET_MESSAGE_TYPE_CADET_DROP_CADET_MESSAGE, + struct GNUNET_CADET_RequestDropCadetMessage, + NULL), + GNUNET_MQ_handler_end ()); /* end of gnunet-service-cadet-new.c */ diff --git a/src/cadet/gnunet-service-cadet.h b/src/cadet/gnunet-service-cadet.h index ff216f8c3..6da0950f1 100644 --- a/src/cadet/gnunet-service-cadet.h +++ b/src/cadet/gnunet-service-cadet.h @@ -325,5 +325,4 @@ const char * GSC_2s (struct CadetClient *c); - #endif diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index e6fce562f..dab53b8c4 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c @@ -385,29 +385,32 @@ struct CadetChannel * Type of message to be droped. See GCT_send. */ uint16_t type GNUNET_PACKED; - + }; /** * Assign type of message to drop. - * @param ch CadetChannel to assign type to drop. + * @param ch CadetChannel to assign type to drop. * @param message GNUNET_CADET_RequestDropCadetMessage to get the type from. */ void -GCCH_assign_type_to_drop(struct CadetChannel *ch, const struct GNUNET_CADET_RequestDropCadetMessage *message) +GCCH_assign_type_to_drop (struct CadetChannel *ch, const struct + GNUNET_CADET_RequestDropCadetMessage *message) { ch->type = message->type; - + } + /** * Check if type of message is the one to drop. - * @param ch CadetChannel to check for message type to drop. + * @param ch CadetChannel to check for message type to drop. * @param message GNUNET_MessageHeader to compare the type with. */ int -GCCH_is_type_to_drop(struct CadetChannel *ch, const struct GNUNET_MessageHeader *message) +GCCH_is_type_to_drop (struct CadetChannel *ch, const struct + GNUNET_MessageHeader *message) { if (ch->type == message->type) @@ -419,6 +422,7 @@ GCCH_is_type_to_drop(struct CadetChannel *ch, const struct GNUNET_MessageHeader return GNUNET_NO; } + /** * Get the static string for identification of the channel. * @@ -854,7 +858,8 @@ send_channel_data_ack (struct CadetChannel *ch) GCCH_2s (ch)); if (NULL != ch->last_control_qe) GCT_send_cancel (ch->last_control_qe); - ch->last_control_qe = GCT_send (ch->t, &msg.header, &send_ack_cb, ch, &msg.ctn); + ch->last_control_qe = GCT_send (ch->t, &msg.header, &send_ack_cb, ch, + &msg.ctn); } @@ -881,7 +886,8 @@ send_open_ack (void *cls) msg.port = ch->port; if (NULL != ch->last_control_qe) GCT_send_cancel (ch->last_control_qe); - ch->last_control_qe = GCT_send (ch->t, &msg.header, &send_ack_cb, ch, &msg.ctn); + ch->last_control_qe = GCT_send (ch->t, &msg.header, &send_ack_cb, ch, + &msg.ctn); } @@ -1513,7 +1519,8 @@ retry_transmission (void *cls) "Retrying transmission on %s of message %u\n", GCCH_2s (ch), (unsigned int) ntohl (crm->data_message->mid.mid)); - crm->qe = GCT_send (ch->t, &crm->data_message->header, &data_sent_cb, crm, &crm->data_message->ctn); + crm->qe = GCT_send (ch->t, &crm->data_message->header, &data_sent_cb, crm, + &crm->data_message->ctn); GNUNET_assert (NULL == ch->retry_data_task); } @@ -1901,7 +1908,8 @@ GCCH_handle_local_data (struct CadetChannel *ch, GNUNET_SCHEDULER_cancel (ch->retry_data_task); ch->retry_data_task = NULL; } - crm->qe = GCT_send (ch->t, &crm->data_message->header, &data_sent_cb, crm, &crm->data_message->ctn); + crm->qe = GCT_send (ch->t, &crm->data_message->header, &data_sent_cb, crm, + &crm->data_message->ctn); GNUNET_assert (NULL == ch->retry_data_task); return GNUNET_OK; } diff --git a/src/cadet/gnunet-service-cadet_connection.c b/src/cadet/gnunet-service-cadet_connection.c index a7c1d9fb0..3e1f779ad 100644 --- a/src/cadet/gnunet-service-cadet_connection.c +++ b/src/cadet/gnunet-service-cadet_connection.c @@ -614,6 +614,7 @@ set_monotime_sig (struct GNUNET_CADET_ConnectionCreateMessage *msg) } + /** * Send a #GNUNET_MESSAGE_TYPE_CADET_CONNECTION_CREATE message to the * first hop. @@ -641,7 +642,7 @@ send_create (void *cls) // check for tunnel state and set signed monotime (xrs,t3ss) t = GCP_get_tunnel (cc->destination, GNUNET_YES); - if ((NULL != t)&& (GCT_get_estate (t) == CADET_TUNNEL_KEY_UNINITIALIZED) && + if ((NULL != t) && (GCT_get_estate (t) == CADET_TUNNEL_KEY_UNINITIALIZED) && (GCT_alice_or_betty (GCP_get_id (cc->destination)) == GNUNET_NO)) { create_msg->has_monotime = GNUNET_YES; diff --git a/src/cadet/gnunet-service-cadet_core.c b/src/cadet/gnunet-service-cadet_core.c index db47c8a90..9a83fa31d 100644 --- a/src/cadet/gnunet-service-cadet_core.c +++ b/src/cadet/gnunet-service-cadet_core.c @@ -826,9 +826,9 @@ handle_connection_create ( // Check for CADET state in case the other side has lost the tunnel (xrs,t3ss) if ((GNUNET_YES == msg->has_monotime) && - (GNUNET_YES == GCP_check_and_update_monotime(origin, msg->monotime)) && - ( GNUNET_OK == GCP_check_monotime_sig(origin, msg)) && - (CADET_TUNNEL_KEY_OK == GCT_get_estate(t))) + (GNUNET_YES == GCP_check_and_update_monotime (origin, msg->monotime)) && + (GNUNET_OK == GCP_check_monotime_sig (origin, msg)) && + (CADET_TUNNEL_KEY_OK == GCT_get_estate (t))) { GCT_change_estate (t, CADET_TUNNEL_KEY_UNINITIALIZED); } diff --git a/src/cadet/gnunet-service-cadet_peer.c b/src/cadet/gnunet-service-cadet_peer.c index e5885278b..a2068b31b 100644 --- a/src/cadet/gnunet-service-cadet_peer.c +++ b/src/cadet/gnunet-service-cadet_peer.c @@ -1552,6 +1552,7 @@ GCP_send_ooo (struct CadetPeer *cp, env); } + /** * Checking if a monotime value is newer than the last monotime value received from a peer. If the time value is newer it will be stored at the peer. * @@ -1574,6 +1575,7 @@ GCP_check_and_update_monotime (struct CadetPeer *peer, return GNUNET_NO; } + /** * Checking the signature for a monotime of a GNUNET_CADET_ConnectionCreateMessage. * diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c index 66e7d5b1e..2ca46b5aa 100644 --- a/src/cadet/gnunet-service-cadet_tunnels.c +++ b/src/cadet/gnunet-service-cadet_tunnels.c @@ -3476,7 +3476,7 @@ GCT_send (struct CadetTunnel *t, { ch = lookup_channel (t, *ctn); - if ((NULL != ch)&& GCCH_is_type_to_drop (ch, message)) + if ((NULL != ch) && GCCH_is_type_to_drop (ch, message)) { GNUNET_break (0); return NULL; diff --git a/src/cadet/gnunet-service-cadet_tunnels.h b/src/cadet/gnunet-service-cadet_tunnels.h index 147f2e56f..075cd03f8 100644 --- a/src/cadet/gnunet-service-cadet_tunnels.h +++ b/src/cadet/gnunet-service-cadet_tunnels.h @@ -235,7 +235,7 @@ GCT_send (struct CadetTunnel *t, const struct GNUNET_MessageHeader *message, GCT_SendContinuation cont, void *cont_cls, - struct GNUNET_CADET_ChannelTunnelNumber *ctn); + struct GNUNET_CADET_ChannelTunnelNumber *ctn); /** diff --git a/src/cadet/test_cadet.c b/src/cadet/test_cadet.c index 779d3bc9f..23f2ccbe3 100644 --- a/src/cadet/test_cadet.c +++ b/src/cadet/test_cadet.c @@ -550,6 +550,7 @@ get_from_p_ids () } } + static struct GNUNET_CADET_Handle * get_from_cadets () { @@ -568,6 +569,7 @@ get_from_cadets () } + static unsigned int get_peer_nr (int outgoing) { @@ -581,6 +583,7 @@ get_peer_nr (int outgoing) } } + /** * Task to reconnect to other peer. * @@ -626,6 +629,7 @@ reconnect_op (void *cls) send_test_message (outgoing_ch); } + void reopen_channel () { @@ -659,6 +663,7 @@ reopen_channel () send_test_message (outgoing_ch); } + static void peers_callback (void *cls, const struct GNUNET_CADET_PeerListEntry *ple); @@ -676,6 +681,7 @@ get_peers (void *cls) } + /** * Method called to retrieve information about all peers in CADET, called * once per peer. @@ -712,7 +718,7 @@ peers_callback (void *cls, const struct GNUNET_CADET_PeerListEntry *ple) "p_id %s\n", GNUNET_i2s_full (p_id)); - if ((0 == GNUNET_memcmp (&ple->peer, p_id))&& ple->have_tunnel) + if ((0 == GNUNET_memcmp (&ple->peer, p_id)) && ple->have_tunnel) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, @@ -733,6 +739,7 @@ peers_callback (void *cls, const struct GNUNET_CADET_PeerListEntry *ple) } } + /** * Function called whenever an MQ-channel is destroyed, unless the destruction * was requested by #GNUNET_CADET_channel_destroy. @@ -1169,7 +1176,7 @@ connect_handler (void *cls, if (peer == get_peer_nr (GNUNET_NO)) { - if ((DESTROY != test)&&(NULL != incoming_ch)) + if ((DESTROY != test) && (NULL != incoming_ch)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Duplicate incoming channel for client %lu\n", diff --git a/src/conversation/test_conversation_api.c b/src/conversation/test_conversation_api.c index dbb742d91..b51186dc8 100644 --- a/src/conversation/test_conversation_api.c +++ b/src/conversation/test_conversation_api.c @@ -402,7 +402,8 @@ namestore_put_cont (void *cls, int32_t success, const char *emsg) GNUNET_assert (GNUNET_YES == success); GNUNET_assert (NULL == emsg); GNUNET_assert (NULL == op); - op = GNUNET_IDENTITY_create (id, "caller-ego", NULL, &caller_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, "caller-ego", NULL, &caller_ego_create_cont, + NULL); } @@ -483,7 +484,8 @@ run (void *cls, cfg = c; GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_test, NULL); id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); - op = GNUNET_IDENTITY_create (id, "phone-ego", NULL, &phone_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, "phone-ego", NULL, &phone_ego_create_cont, + NULL); ns = GNUNET_NAMESTORE_connect (cfg); } diff --git a/src/conversation/test_conversation_api_reject.c b/src/conversation/test_conversation_api_reject.c index 855b21fd7..69fa9f1dc 100644 --- a/src/conversation/test_conversation_api_reject.c +++ b/src/conversation/test_conversation_api_reject.c @@ -255,7 +255,8 @@ namestore_put_cont (void *cls, int32_t success, const char *emsg) GNUNET_assert (GNUNET_YES == success); GNUNET_assert (NULL == emsg); GNUNET_assert (NULL == op); - op = GNUNET_IDENTITY_create (id, "caller-ego", NULL, &caller_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, "caller-ego", NULL, &caller_ego_create_cont, + NULL); } @@ -336,7 +337,8 @@ run (void *cls, cfg = c; GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_test, NULL); id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); - op = GNUNET_IDENTITY_create (id, "phone-ego", NULL, &phone_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, "phone-ego", NULL, &phone_ego_create_cont, + NULL); ns = GNUNET_NAMESTORE_connect (cfg); } diff --git a/src/conversation/test_conversation_api_twocalls.c b/src/conversation/test_conversation_api_twocalls.c index 6d434a3e1..83e8cb55a 100644 --- a/src/conversation/test_conversation_api_twocalls.c +++ b/src/conversation/test_conversation_api_twocalls.c @@ -524,7 +524,8 @@ namestore_put_cont (void *cls, int32_t success, const char *emsg) GNUNET_assert (GNUNET_YES == success); GNUNET_assert (NULL == emsg); GNUNET_assert (NULL == op); - op = GNUNET_IDENTITY_create (id, "caller-ego", NULL, &caller_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, "caller-ego", NULL, &caller_ego_create_cont, + NULL); } @@ -613,7 +614,8 @@ run (void *cls, timeout_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_test, NULL); GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); id = GNUNET_IDENTITY_connect (cfg, &identity_cb, NULL); - op = GNUNET_IDENTITY_create (id, "phone-ego", NULL, &phone_ego_create_cont, NULL); + op = GNUNET_IDENTITY_create (id, "phone-ego", NULL, &phone_ego_create_cont, + NULL); ns = GNUNET_NAMESTORE_connect (cfg); } diff --git a/src/curl/curl.c b/src/curl/curl.c index b3d2af252..eb9dd6a29 100644 --- a/src/curl/curl.c +++ b/src/curl/curl.c @@ -195,14 +195,14 @@ struct GNUNET_CURL_Context /** * Passphrase to decrypt @e keyfile, or NULL. - */ + */ char *keypass; }; /** - * Force use of the provided username and password + * Force use of the provided username and password * for client authentication for all operations performed * with @a ctx. * @@ -605,8 +605,8 @@ GNUNET_CURL_job_add_with_ct_json (struct GNUNET_CURL_Context *ctx, struct curl_slist *job_headers = NULL; GNUNET_assert (NULL != (job_headers = - curl_slist_append (NULL, - "Content-Type: application/json"))); + curl_slist_append (NULL, + "Content-Type: application/json"))); job = GNUNET_CURL_job_add2 (ctx, eh, job_headers, diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index 508f9cadc..155486be5 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c @@ -214,13 +214,13 @@ write_update_information_graph (struct GNUNET_FS_UpdateInformationGraph *uig) n = uig->update_nodes[i]; uris = GNUNET_FS_uri_to_string (n->uri); struct GNUNET_BIO_WriteSpec ws[] = { - GNUNET_BIO_write_spec_string("fs-namespace-node-id", n->id), - GNUNET_BIO_write_spec_meta_data("fs-namespace-node-meta", n->md), - GNUNET_BIO_write_spec_string("fs-namespace-node-update", n->update), - GNUNET_BIO_write_spec_string("fs-namespace-uris", uris), - GNUNET_BIO_write_spec_end(), + GNUNET_BIO_write_spec_string ("fs-namespace-node-id", n->id), + GNUNET_BIO_write_spec_meta_data ("fs-namespace-node-meta", n->md), + GNUNET_BIO_write_spec_string ("fs-namespace-node-update", n->update), + GNUNET_BIO_write_spec_string ("fs-namespace-uris", uris), + GNUNET_BIO_write_spec_end (), }; - if (GNUNET_OK != GNUNET_BIO_write_spec_commit(wh, ws)) + if (GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws)) { GNUNET_free (uris); break; @@ -292,11 +292,11 @@ read_update_information_graph (struct GNUNET_FS_Handle *h, { n = GNUNET_new (struct NamespaceUpdateNode); struct GNUNET_BIO_ReadSpec rs[] = { - GNUNET_BIO_read_spec_string("identifier", &n->id, 1024), - GNUNET_BIO_read_spec_meta_data("meta", &n->md), - GNUNET_BIO_read_spec_string("update-id", &n->update, 1024), - GNUNET_BIO_read_spec_string("uri", &uris, 1024 * 2), - GNUNET_BIO_read_spec_end(), + GNUNET_BIO_read_spec_string ("identifier", &n->id, 1024), + GNUNET_BIO_read_spec_meta_data ("meta", &n->md), + GNUNET_BIO_read_spec_string ("update-id", &n->update, 1024), + GNUNET_BIO_read_spec_string ("uri", &uris, 1024 * 2), + GNUNET_BIO_read_spec_end (), }; if (GNUNET_OK != GNUNET_BIO_read_spec_commit (rh, rs)) { diff --git a/src/fs/gnunet-auto-share.c b/src/fs/gnunet-auto-share.c index 41dfe781a..f91e9d00d 100644 --- a/src/fs/gnunet-auto-share.c +++ b/src/fs/gnunet-auto-share.c @@ -201,9 +201,9 @@ load_state () while (n-- > 0) { struct GNUNET_BIO_ReadSpec rs[] = { - GNUNET_BIO_read_spec_string("filename", &fn, 1024), - GNUNET_BIO_read_spec_object("id", &id, sizeof(struct GNUNET_HashCode)), - GNUNET_BIO_read_spec_end(), + GNUNET_BIO_read_spec_string ("filename", &fn, 1024), + GNUNET_BIO_read_spec_object ("id", &id, sizeof(struct GNUNET_HashCode)), + GNUNET_BIO_read_spec_end (), }; if (GNUNET_OK != GNUNET_BIO_read_spec_commit (rh, rs)) goto error; @@ -258,7 +258,8 @@ write_item (void *cls, const struct GNUNET_HashCode *key, void *value) struct GNUNET_BIO_WriteSpec ws[] = { GNUNET_BIO_write_spec_string ("auto-share-write-item-filename", wi->filename), - GNUNET_BIO_write_spec_object ("id", &wi->id, sizeof(struct GNUNET_HashCode)), + GNUNET_BIO_write_spec_object ("id", &wi->id, sizeof(struct + GNUNET_HashCode)), GNUNET_BIO_write_spec_end (), }; if (GNUNET_OK != GNUNET_BIO_write_spec_commit (wh, ws)) @@ -747,7 +748,7 @@ main (int argc, char *const *argv) if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) return 2; - sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO); + sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE); GNUNET_assert (NULL != sigpipe); shc_chld = GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index 0d99d822e..bf95bf340 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c @@ -427,4 +427,5 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, proc_cls); } + /* end of gns_api.c */ diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c index 74309f554..0a9b7c861 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c @@ -190,6 +190,7 @@ do_shutdown (void *cls) } } + /** * Shuffle answers * Fisher-Yates (aka Knuth) Shuffle @@ -216,6 +217,7 @@ shuffle_answers (struct Request *request) } } + /** * Send the response for the given request and clean up. * diff --git a/src/gns/nss/nss_gns.c b/src/gns/nss/nss_gns.c index 36799ba3a..77b4340ee 100644 --- a/src/gns/nss/nss_gns.c +++ b/src/gns/nss/nss_gns.c @@ -38,7 +38,7 @@ /** macro to align idx to 32bit boundary */ #define ALIGN(idx) do { \ if (idx % sizeof(void*)) \ - idx += (sizeof(void*) - idx % sizeof(void*)); /* Align on 32 bit boundary */ \ + idx += (sizeof(void*) - idx % sizeof(void*)); /* Align on 32 bit boundary */ \ } while (0) diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c index 11e46ad7f..96e8e10da 100644 --- a/src/gns/nss/nss_gns_query.c +++ b/src/gns/nss/nss_gns_query.c @@ -150,7 +150,7 @@ query_gns: if (1 == retry) return -2; /* no go -> service unavailable */ retry = 1; - system("gnunet-arm -s"); + system ("gnunet-arm -s"); goto query_gns; /* Try again */ } if (3 == WEXITSTATUS (ret)) diff --git a/src/gnsrecord/gnsrecord.c b/src/gnsrecord/gnsrecord.c index 3cbf5fc8d..8d5a6d95b 100644 --- a/src/gnsrecord/gnsrecord.c +++ b/src/gnsrecord/gnsrecord.c @@ -106,11 +106,11 @@ init () const struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default (); if (pd != dpd) - GNUNET_OS_init(dpd); + GNUNET_OS_init (dpd); GNUNET_PLUGIN_load_all ("libgnunet_plugin_gnsrecord_", NULL, &add_plugin, NULL); if (pd != dpd) - GNUNET_OS_init(pd); + GNUNET_OS_init (pd); } @@ -125,7 +125,7 @@ GNSRECORD_fini () const struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default (); if (pd != dpd) - GNUNET_OS_init(dpd); + GNUNET_OS_init (dpd); for (unsigned int i = 0; i < num_plugins; i++) { @@ -139,7 +139,7 @@ GNSRECORD_fini () GNUNET_free (gns_plugins); if (pd != dpd) - GNUNET_OS_init(pd); + GNUNET_OS_init (pd); gns_plugins = NULL; once = 0; diff --git a/src/hostlist/gnunet-daemon-hostlist_client.c b/src/hostlist/gnunet-daemon-hostlist_client.c index 5dc2e7f2a..b377f2041 100644 --- a/src/hostlist/gnunet-daemon-hostlist_client.c +++ b/src/hostlist/gnunet-daemon-hostlist_client.c @@ -540,12 +540,12 @@ download_get_url () { \ ret = curl_easy_setopt (c, a, b); \ if (CURLE_OK != ret) \ - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, \ - _ ("%s failed at %s:%d: `%s'\n"), \ - "curl_easy_setopt", \ - __FILE__, \ - __LINE__, \ - curl_easy_strerror (ret)); \ + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, \ + _ ("%s failed at %s:%d: `%s'\n"), \ + "curl_easy_setopt", \ + __FILE__, \ + __LINE__, \ + curl_easy_strerror (ret)); \ } while (0) @@ -1418,11 +1418,12 @@ load_hostlist_file () counter = 0; struct GNUNET_BIO_ReadSpec rs[] = { - GNUNET_BIO_read_spec_int32 ("times used", (int32_t *)×_used), + GNUNET_BIO_read_spec_int32 ("times used", (int32_t *) ×_used), GNUNET_BIO_read_spec_int64 ("quality", (int64_t *) &quality), GNUNET_BIO_read_spec_int64 ("last used", (int64_t *) &last_used), GNUNET_BIO_read_spec_int64 ("created", (int64_t *) &created), - GNUNET_BIO_read_spec_int32 ("hellos returned", (int32_t *) &hellos_returned), + GNUNET_BIO_read_spec_int32 ("hellos returned", + (int32_t *) &hellos_returned), GNUNET_BIO_read_spec_end (), }; while ((GNUNET_OK == GNUNET_BIO_read_string (rh, "url", &uri, MAX_URL_LEN)) && @@ -1527,7 +1528,8 @@ save_hostlist_file (int shutdown) { struct GNUNET_BIO_WriteSpec ws[] = { GNUNET_BIO_write_spec_string ("hostlist uri", pos->hostlist_uri), - GNUNET_BIO_write_spec_int32 ("times used", (int32_t *) &pos->times_used), + GNUNET_BIO_write_spec_int32 ("times used", + (int32_t *) &pos->times_used), GNUNET_BIO_write_spec_int64 ("quality", (int64_t *) &pos->quality), GNUNET_BIO_write_spec_int64 ( "last usage", diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c index cf44afd1f..d0f5546f3 100644 --- a/src/identity/gnunet-identity.c +++ b/src/identity/gnunet-identity.c @@ -406,7 +406,8 @@ run (void *cls, GNUNET_STRINGS_string_to_data (privkey_ego, strlen (privkey_ego), &pk, - sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey)); + sizeof(struct + GNUNET_CRYPTO_EcdsaPrivateKey)); create_op = GNUNET_IDENTITY_create (sh, create_ego, @@ -452,7 +453,8 @@ main (int argc, char *const *argv) GNUNET_GETOPT_option_string ('P', "privkey", "PRIVATE_KEY", - gettext_noop ("set the private key for the identity to PRIVATE_KEY (use together with -C)"), + gettext_noop ( + "set the private key for the identity to PRIVATE_KEY (use together with -C)"), &privkey_ego), GNUNET_GETOPT_option_flag ('d', "display", diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c index 5aca07ddf..02e42d03f 100644 --- a/src/identity/plugin_rest_identity.c +++ b/src/identity/plugin_rest_identity.c @@ -1065,7 +1065,8 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle, GNUNET_STRINGS_string_to_data (privkey, strlen (privkey), &pk, - sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey)); + sizeof(struct + GNUNET_CRYPTO_EcdsaPrivateKey)); pk_ptr = &pk; } else diff --git a/src/include/gnunet_bio_lib.h b/src/include/gnunet_bio_lib.h index 687334c1c..e49ce1354 100644 --- a/src/include/gnunet_bio_lib.h +++ b/src/include/gnunet_bio_lib.h @@ -138,9 +138,9 @@ GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, * @param f address of float to read */ int -GNUNET_BIO_read_float(struct GNUNET_BIO_ReadHandle *h, - const char *what, - float *f); +GNUNET_BIO_read_float (struct GNUNET_BIO_ReadHandle *h, + const char *what, + float *f); /** @@ -151,10 +151,9 @@ GNUNET_BIO_read_float(struct GNUNET_BIO_ReadHandle *h, * @param f address of double to read */ int -GNUNET_BIO_read_double(struct GNUNET_BIO_ReadHandle *h, - const char *what, - double *f); - +GNUNET_BIO_read_double (struct GNUNET_BIO_ReadHandle *h, + const char *what, + double *f); /** @@ -171,7 +170,6 @@ GNUNET_BIO_read_int32 (struct GNUNET_BIO_ReadHandle *h, int32_t *i); - /** * Read an (u)int64_t. * @@ -186,7 +184,6 @@ GNUNET_BIO_read_int64 (struct GNUNET_BIO_ReadHandle *h, int64_t *i); - /****************************** WRITING API *******************************/ /** @@ -310,9 +307,9 @@ GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, * @param f float to write (must be a variable) */ int -GNUNET_BIO_write_float(struct GNUNET_BIO_WriteHandle *h, - const char *what, - float f); +GNUNET_BIO_write_float (struct GNUNET_BIO_WriteHandle *h, + const char *what, + float f); /** * Write a double. @@ -322,9 +319,9 @@ GNUNET_BIO_write_float(struct GNUNET_BIO_WriteHandle *h, * @param f double to write (must be a variable) */ int -GNUNET_BIO_write_double(struct GNUNET_BIO_WriteHandle *h, - const char *what, - double f); +GNUNET_BIO_write_double (struct GNUNET_BIO_WriteHandle *h, + const char *what, + double f); /** @@ -490,7 +487,7 @@ GNUNET_BIO_read_spec_int64 (const char *what, * @param f address of float to read */ struct GNUNET_BIO_ReadSpec -GNUNET_BIO_read_spec_float(const char *what, float *f); +GNUNET_BIO_read_spec_float (const char *what, float *f); /** @@ -500,7 +497,7 @@ GNUNET_BIO_read_spec_float(const char *what, float *f); * @param f address of double to read */ struct GNUNET_BIO_ReadSpec -GNUNET_BIO_read_spec_double(const char *what, double *f); +GNUNET_BIO_read_spec_double (const char *what, double *f); /** @@ -647,7 +644,7 @@ GNUNET_BIO_write_spec_int64 (const char *what, * @return the write spec */ struct GNUNET_BIO_WriteSpec -GNUNET_BIO_write_spec_float(const char *what, float *f); +GNUNET_BIO_write_spec_float (const char *what, float *f); /** @@ -658,7 +655,7 @@ GNUNET_BIO_write_spec_float(const char *what, float *f); * @return the write spec */ struct GNUNET_BIO_WriteSpec -GNUNET_BIO_write_spec_double(const char *what, double *f); +GNUNET_BIO_write_spec_double (const char *what, double *f); /** diff --git a/src/include/gnunet_buffer_lib.h b/src/include/gnunet_buffer_lib.h index e23536ab2..e09ec130a 100644 --- a/src/include/gnunet_buffer_lib.h +++ b/src/include/gnunet_buffer_lib.h @@ -147,7 +147,7 @@ GNUNET_buffer_write_fstr (struct GNUNET_Buffer *buf, const char *fmt, ...); */ void GNUNET_buffer_write_vfstr (struct GNUNET_Buffer *buf, const char *fmt, va_list - args); + args); /** diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index b2f99cd55..91d4a5bd4 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -457,11 +457,11 @@ __attribute__ ((format (printf, 2, 3))); __extension__ ({ \ int _gnunet_boolean_var_; \ if (expr) \ - _gnunet_boolean_var_ = 1; \ + _gnunet_boolean_var_ = 1; \ else \ - _gnunet_boolean_var_ = 0; \ + _gnunet_boolean_var_ = 0; \ _gnunet_boolean_var_; \ - }) + }) #define GN_LIKELY(expr) (__builtin_expect (_GNUNET_BOOLEAN_EXPR (expr), 1)) #define GN_UNLIKELY(expr) (__builtin_expect (_GNUNET_BOOLEAN_EXPR (expr), 0)) #else @@ -499,12 +499,12 @@ GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) \ { \ if (GN_UNLIKELY (log_call_enabled == -1)) \ - log_call_enabled = \ - GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \ - (comp), \ - __FILE__, \ - __FUNCTION__, \ - __LINE__); \ + log_call_enabled = \ + GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \ + (comp), \ + __FILE__, \ + __FUNCTION__, \ + __LINE__); \ if (GN_UNLIKELY (GNUNET_get_log_skip () > 0)) \ { \ GNUNET_log_skip (-1, GNUNET_NO); \ @@ -512,7 +512,7 @@ GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, else \ { \ if (GN_UNLIKELY (log_call_enabled)) \ - GNUNET_log_from_nocheck ((kind), comp, __VA_ARGS__); \ + GNUNET_log_from_nocheck ((kind), comp, __VA_ARGS__); \ } \ } \ } while (0) @@ -525,12 +525,12 @@ GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, ((GNUNET_ERROR_TYPE_DEBUG & (kind)) == 0)) \ { \ if (GN_UNLIKELY (log_call_enabled == -1)) \ - log_call_enabled = \ - GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \ - NULL, \ - __FILE__, \ - __FUNCTION__, \ - __LINE__); \ + log_call_enabled = \ + GNUNET_get_log_call_status ((kind) & (~GNUNET_ERROR_TYPE_BULK), \ + NULL, \ + __FILE__, \ + __FUNCTION__, \ + __LINE__); \ if (GN_UNLIKELY (GNUNET_get_log_skip () > 0)) \ { \ GNUNET_log_skip (-1, GNUNET_NO); \ @@ -538,7 +538,7 @@ GNUNET_log_from_nocheck (enum GNUNET_ErrorType kind, else \ { \ if (GN_UNLIKELY (log_call_enabled)) \ - GNUNET_log_nocheck ((kind), __VA_ARGS__); \ + GNUNET_log_nocheck ((kind), __VA_ARGS__); \ } \ } \ } while (0) @@ -1319,8 +1319,8 @@ GNUNET_is_zero_ (const void *a, * been returned by #GNUNET_strdup, #GNUNET_strndup, #GNUNET_malloc or #GNUNET_array_grow earlier. NULL is allowed. */ #define GNUNET_free(ptr) do { \ - GNUNET_xfree_ (ptr, __FILE__, __LINE__); \ - ptr = NULL; \ + GNUNET_xfree_ (ptr, __FILE__, __LINE__); \ + ptr = NULL; \ } while (0) diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h index b5ceb5b94..f782509eb 100644 --- a/src/include/gnunet_configuration_lib.h +++ b/src/include/gnunet_configuration_lib.h @@ -109,7 +109,7 @@ GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, * @return a freshly allocated configuration */ struct GNUNET_CONFIGURATION_Handle * -GNUNET_CONFIGURATION_default(void); +GNUNET_CONFIGURATION_default (void); /** diff --git a/src/include/gnunet_constants.h b/src/include/gnunet_constants.h index c83bec683..8b3cbc7e6 100644 --- a/src/include/gnunet_constants.h +++ b/src/include/gnunet_constants.h @@ -47,7 +47,8 @@ extern "C" * so that at least one maximum-size message can be send roughly once * per minute. */ -#define GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT GNUNET_BANDWIDTH_value_init (1024*1024) +#define GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT GNUNET_BANDWIDTH_value_init (1024 \ + * 1024) /** * After how long do we consider a connection to a peer dead diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index f3325a064..8d8cbf4c1 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h @@ -2158,9 +2158,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( (element)->next = (head); \ (element)->prev = NULL; \ if ((tail) == NULL) \ - (tail) = element; \ + (tail) = element; \ else \ - (head)->prev = element; \ + (head)->prev = element; \ (head) = (element); \ } while (0) @@ -2182,9 +2182,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( (element)->prev = (tail); \ (element)->next = NULL; \ if ((head) == NULL) \ - (head) = element; \ + (head) = element; \ else \ - (tail)->next = element; \ + (tail)->next = element; \ (tail) = (element); \ } while (0) @@ -2216,9 +2216,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( (other)->next = (element); \ } \ if (NULL == (element)->next) \ - (tail) = (element); \ + (tail) = (element); \ else \ - (element)->next->prev = (element); \ + (element)->next->prev = (element); \ } while (0) @@ -2249,9 +2249,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( (other)->prev = (element); \ } \ if (NULL == (element)->prev) \ - (head) = (element); \ + (head) = (element); \ else \ - (element)->prev->next = (element); \ + (element)->prev->next = (element); \ } while (0) @@ -2275,13 +2275,13 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( GNUNET_assert (((element)->prev != NULL) || ((head) == (element))); \ GNUNET_assert (((element)->next != NULL) || ((tail) == (element))); \ if ((element)->prev == NULL) \ - (head) = (element)->next; \ + (head) = (element)->next; \ else \ - (element)->prev->next = (element)->next; \ + (element)->prev->next = (element)->next; \ if ((element)->next == NULL) \ - (tail) = (element)->prev; \ + (tail) = (element)->prev; \ else \ - (element)->next->prev = (element)->prev; \ + (element)->next->prev = (element)->prev; \ (element)->next = NULL; \ (element)->prev = NULL; \ } while (0) @@ -2308,9 +2308,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( (element)->next_ ## mdll = (head); \ (element)->prev_ ## mdll = NULL; \ if ((tail) == NULL) \ - (tail) = element; \ + (tail) = element; \ else \ - (head)->prev_ ## mdll = element; \ + (head)->prev_ ## mdll = element; \ (head) = (element); \ } while (0) @@ -2333,9 +2333,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( (element)->prev_ ## mdll = (tail); \ (element)->next_ ## mdll = NULL; \ if ((head) == NULL) \ - (head) = element; \ + (head) = element; \ else \ - (tail)->next_ ## mdll = element; \ + (tail)->next_ ## mdll = element; \ (tail) = (element); \ } while (0) @@ -2368,9 +2368,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( (other)->next_ ## mdll = (element); \ } \ if (NULL == (element)->next_ ## mdll) \ - (tail) = (element); \ + (tail) = (element); \ else \ - (element)->next_ ## mdll->prev_ ## mdll = (element); \ + (element)->next_ ## mdll->prev_ ## mdll = (element); \ } while (0) @@ -2402,9 +2402,9 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( (other)->prev_ ## mdll = (element); \ } \ if (NULL == (element)->prev_ ## mdll) \ - (head) = (element); \ + (head) = (element); \ else \ - (element)->prev_ ## mdll->next_ ## mdll = (element); \ + (element)->prev_ ## mdll->next_ ## mdll = (element); \ } while (0) @@ -2425,13 +2425,13 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( GNUNET_assert (((element)->prev_ ## mdll != NULL) || ((head) == (element))); \ GNUNET_assert (((element)->next_ ## mdll != NULL) || ((tail) == (element))); \ if ((element)->prev_ ## mdll == NULL) \ - (head) = (element)->next_ ## mdll; \ + (head) = (element)->next_ ## mdll; \ else \ - (element)->prev_ ## mdll->next_ ## mdll = (element)->next_ ## mdll; \ + (element)->prev_ ## mdll->next_ ## mdll = (element)->next_ ## mdll; \ if ((element)->next_ ## mdll == NULL) \ - (tail) = (element)->prev_ ## mdll; \ + (tail) = (element)->prev_ ## mdll; \ else \ - (element)->next_ ## mdll->prev_ ## mdll = (element)->prev_ ## mdll; \ + (element)->next_ ## mdll->prev_ ## mdll = (element)->prev_ ## mdll; \ (element)->next_ ## mdll = NULL; \ (element)->prev_ ## mdll = NULL; \ } while (0) @@ -2468,8 +2468,8 @@ GNUNET_CONTAINER_multihashmap32_iterator_destroy ( TYPE *pos; \ \ for (pos = head; NULL != pos; pos = pos->next) \ - if (0 < comparator (comparator_cls, element, pos)) \ - break; /* element < pos */ \ + if (0 < comparator (comparator_cls, element, pos)) \ + break; /* element < pos */ \ if (NULL == pos) /* => element > tail */ \ { \ GNUNET_CONTAINER_DLL_insert_tail (head, tail, element); \ diff --git a/src/include/gnunet_curl_lib.h b/src/include/gnunet_curl_lib.h index 8f744512d..9de58d608 100644 --- a/src/include/gnunet_curl_lib.h +++ b/src/include/gnunet_curl_lib.h @@ -262,7 +262,7 @@ GNUNET_CURL_job_add_with_ct_json (struct GNUNET_CURL_Context *ctx, /** - * Force use of the provided username and password + * Force use of the provided username and password * for client authentication for all operations performed * with @a ctx. * diff --git a/src/include/gnunet_disk_lib.h b/src/include/gnunet_disk_lib.h index f43cf8943..51ae7d8d5 100644 --- a/src/include/gnunet_disk_lib.h +++ b/src/include/gnunet_disk_lib.h @@ -390,34 +390,55 @@ GNUNET_DISK_file_handle_size (struct GNUNET_DISK_FileHandle *fh, off_t *size); +/** + * Flags for #GNUNET_DISK_pipe(). + */ +enum GNUNET_DISK_PipeFlags +{ + + /** + * No special options, use non-blocking read/write operations. + */ + GNUNET_DISK_PF_NONE, + + /** + * Configure read end to block when reading if set. + */ + GNUNET_DISK_PF_BLOCKING_READ = 1, + /** + * Configure write end to block when writing if set. + */ + GNUNET_DISK_PF_BLOCKING_WRITE = 2, + + /** + * Configure both pipe ends for blocking operations if set. + */ + GNUNET_DISK_PF_BLOCKING_RW = GNUNET_DISK_PF_BLOCKING_READ + | GNUNET_DISK_PF_BLOCKING_WRITE + +}; + + /** * Creates an interprocess channel * - * @param blocking_read creates an asynchronous pipe for reading if set to #GNUNET_NO - * @param blocking_write creates an asynchronous pipe for writing if set to #GNUNET_NO - * @param inherit_read 1 to make read handle inheritable, 0 otherwise (NT only) - * @param inherit_write 1 to make write handle inheritable, 0 otherwise (NT only) + * @param pf how to configure the pipe * @return handle to the new pipe, NULL on error */ struct GNUNET_DISK_PipeHandle * -GNUNET_DISK_pipe (int blocking_read, - int blocking_write, - int inherit_read, - int inherit_write); +GNUNET_DISK_pipe (enum GNUNET_DISK_PipeFlags pf); /** * Creates a pipe object from a couple of file descriptors. * Useful for wrapping existing pipe FDs. * - * @param blocking_read creates an asynchronous pipe for reading if set to #GNUNET_NO - * @param blocking_write creates an asynchronous pipe for writing if set to #GNUNET_NO + * @param pf how to configure the pipe * @param fd an array of two fd values. One of them may be -1 for read-only or write-only pipes * @return handle to the new pipe, NULL on error */ struct GNUNET_DISK_PipeHandle * -GNUNET_DISK_pipe_from_fd (int blocking_read, - int blocking_write, +GNUNET_DISK_pipe_from_fd (enum GNUNET_DISK_PipeFlags pf, int fd[2]); @@ -479,6 +500,7 @@ const struct GNUNET_DISK_FileHandle * GNUNET_DISK_pipe_handle (const struct GNUNET_DISK_PipeHandle *p, enum GNUNET_DISK_PipeEnd n); + /** * Update POSIX permissions mask of a file on disk. If both argumets * are #GNUNET_NO, the file is made world-read-write-executable (777). diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h index 520027dbb..37f21e5b1 100644 --- a/src/include/gnunet_mq_lib.h +++ b/src/include/gnunet_mq_lib.h @@ -547,7 +547,7 @@ struct GNUNET_MQ_MessageHandler */ #define GNUNET_MQ_hd_fixed_size(name, code, str, ctx) \ ({ \ - void (*_cb)(void *cls, const str * msg) = &handle_ ## name; \ + void (*_cb)(void *cls, const str *msg) = &handle_ ## name; \ ((struct GNUNET_MQ_MessageHandler){ NULL, \ (GNUNET_MQ_MessageCallback) _cb, \ (ctx), \ @@ -598,8 +598,8 @@ struct GNUNET_MQ_MessageHandler */ #define GNUNET_MQ_hd_var_size(name, code, str, ctx) \ __extension__ ({ \ - int (*_mv)(void *cls, const str * msg) = &check_ ## name; \ - void (*_cb)(void *cls, const str * msg) = &handle_ ## name; \ + int (*_mv)(void *cls, const str *msg) = &check_ ## name; \ + void (*_cb)(void *cls, const str *msg) = &handle_ ## name; \ ((struct GNUNET_MQ_MessageHandler){ (GNUNET_MQ_MessageValidationCallback) \ _mv, \ (GNUNET_MQ_MessageCallback) _cb, \ diff --git a/src/include/gnunet_reclaim_lib.h b/src/include/gnunet_reclaim_lib.h index 54d284f3c..4f2d6dba5 100644 --- a/src/include/gnunet_reclaim_lib.h +++ b/src/include/gnunet_reclaim_lib.h @@ -80,7 +80,7 @@ static const struct GNUNET_RECLAIM_Identifier GNUNET_RECLAIM_ID_ZERO; memcmp (a, \ b, \ sizeof (GNUNET_RECLAIM_ID_ZERO))) \ - ? \ + ? \ GNUNET_YES : GNUNET_NO) diff --git a/src/include/gnunet_reclaim_plugin.h b/src/include/gnunet_reclaim_plugin.h index 992ad0cc3..7ee9e730f 100644 --- a/src/include/gnunet_reclaim_plugin.h +++ b/src/include/gnunet_reclaim_plugin.h @@ -172,7 +172,9 @@ typedef const char *(*GNUNET_RECLAIM_AttestationNumberToTypenameFunction) ( * @param attest the attestation object * @return an attribute list */ -typedef struct GNUNET_RECLAIM_AttributeList *(*GNUNET_RECLAIM_AttestationGetAttributesFunction) ( +typedef struct + GNUNET_RECLAIM_AttributeList *(* +GNUNET_RECLAIM_AttestationGetAttributesFunction) ( void *cls, const struct GNUNET_RECLAIM_Attestation *attest); @@ -201,7 +203,6 @@ typedef int (*GNUNET_RECLAIM_AttestationGetExpirationFunction) ( struct GNUNET_TIME_Absolute *expiration); - /** * Each plugin is required to return a pointer to a struct of this * type as the return value from its entry point. @@ -283,7 +284,6 @@ struct GNUNET_RECLAIM_AttestationPluginFunctions }; - #if 0 /* keep Emacsens' auto-indent happy */ { #endif diff --git a/src/include/gnunet_reclaim_service.h b/src/include/gnunet_reclaim_service.h index 813bc1a59..139c44ae7 100644 --- a/src/include/gnunet_reclaim_service.h +++ b/src/include/gnunet_reclaim_service.h @@ -335,7 +335,8 @@ GNUNET_RECLAIM_get_attestations_start ( * @param it the iterator */ void -GNUNET_RECLAIM_get_attestations_next (struct GNUNET_RECLAIM_AttestationIterator *ait); +GNUNET_RECLAIM_get_attestations_next (struct + GNUNET_RECLAIM_AttestationIterator *ait); /** @@ -346,7 +347,8 @@ GNUNET_RECLAIM_get_attestations_next (struct GNUNET_RECLAIM_AttestationIterator * @param it the iterator */ void -GNUNET_RECLAIM_get_attestations_stop (struct GNUNET_RECLAIM_AttestationIterator *ait); +GNUNET_RECLAIM_get_attestations_stop (struct + GNUNET_RECLAIM_AttestationIterator *ait); /** diff --git a/src/include/platform.h b/src/include/platform.h index baaf26ad6..10248e5bb 100644 --- a/src/include/platform.h +++ b/src/include/platform.h @@ -233,8 +233,8 @@ atoll (const char *nptr); #if defined(__sparc__) -#define MAKE_UNALIGNED(val) ({ __typeof__((val))__tmp; memmove (&__tmp, &(val), \ - sizeof((val))); \ +#define MAKE_UNALIGNED(val) ({ __typeof__((val)) __tmp; memmove (&__tmp, &(val), \ + sizeof((val))); \ __tmp; }) #else #define MAKE_UNALIGNED(val) val diff --git a/src/json/json_generator.c b/src/json/json_generator.c index 594fcaf27..3f82a5f17 100644 --- a/src/json/json_generator.c +++ b/src/json/json_generator.c @@ -254,7 +254,9 @@ GNUNET_JSON_from_gnsrecord (const char*rname, rel_exp.rel_value_us = rd[i].expiration_time; expiration_time_str = GNUNET_STRINGS_relative_time_to_string (rel_exp, GNUNET_NO); - } else { + } + else + { abs_exp.abs_value_us = rd[i].expiration_time; expiration_time_str = GNUNET_STRINGS_absolute_time_to_string (abs_exp); } diff --git a/src/json/json_gnsrecord.c b/src/json/json_gnsrecord.c index fe5858f06..7e11aba94 100644 --- a/src/json/json_gnsrecord.c +++ b/src/json/json_gnsrecord.c @@ -136,8 +136,8 @@ parse_record (json_t *data, struct GNUNET_GNSRECORD_Data *rd) } else if ((1 != rel_exp) && (GNUNET_OK == - GNUNET_STRINGS_fancy_time_to_absolute (expiration_time, - &abs_expiration_time))) + GNUNET_STRINGS_fancy_time_to_absolute (expiration_time, + &abs_expiration_time))) { rd->expiration_time = abs_expiration_time.abs_value_us; } diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 704a4abf7..07d045b90 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c @@ -1048,7 +1048,8 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg) return; } add = 1; - typestring = GNUNET_strdup (GNUNET_GNSRECORD_number_to_typename (GNUNET_GNSRECORD_TYPE_NICK)); + typestring = GNUNET_strdup (GNUNET_GNSRECORD_number_to_typename ( + GNUNET_GNSRECORD_TYPE_NICK)); name = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT); value = GNUNET_strdup (nickstring); is_public = 0; diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index ede566d40..bb8138e23 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -915,7 +915,7 @@ refresh_block (struct NamestoreClient *nc, nick = get_nick_record (zone_key); res_count = rd_count; res = (struct GNUNET_GNSRECORD_Data *) rd; /* fixme: a bit unclean... */ - if (NULL != nick && (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT))) + if ((NULL != nick) && (0 != strcmp (name, GNUNET_GNS_EMPTY_LABEL_AT))) { nick->flags = (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index 4a05b2833..f1cbfb38b 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c @@ -536,6 +536,7 @@ namestore_list_iteration (void *cls, GNUNET_NAMESTORE_zone_iterator_next (handle->list_it, 1); } + /** * Handle lookup error * @@ -553,10 +554,10 @@ ns_lookup_error_cb (void *cls) static void ns_get_lookup_cb (void *cls, - const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, - const char *label, - unsigned int rd_len, - const struct GNUNET_GNSRECORD_Data *rd) + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, + const char *label, + unsigned int rd_len, + const struct GNUNET_GNSRECORD_Data *rd) { struct RequestHandle *handle = cls; struct GNUNET_GNSRECORD_Data rd_filtered[rd_len]; @@ -588,8 +589,6 @@ ns_get_lookup_cb (void *cls, } - - /** * Handle namestore GET request * @@ -666,12 +665,12 @@ namestore_get (struct GNUNET_REST_RequestHandle *con_handle, } handle->record_name = GNUNET_strdup (labelname + 1); handle->ns_qe = GNUNET_NAMESTORE_records_lookup (handle->ns_handle, - handle->zone_pkey, - handle->record_name, - &ns_lookup_error_cb, - handle, - &ns_get_lookup_cb, - handle); + handle->zone_pkey, + handle->record_name, + &ns_lookup_error_cb, + handle, + &ns_get_lookup_cb, + handle); if (NULL == handle->ns_qe) { handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); @@ -681,7 +680,6 @@ namestore_get (struct GNUNET_REST_RequestHandle *con_handle, } - static void ns_lookup_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, @@ -702,12 +700,12 @@ ns_lookup_cb (void *cls, for (j = 0; j < handle->rd_count; j++) rd_new[i + j] = handle->rd[j]; handle->ns_qe = GNUNET_NAMESTORE_records_store (handle->ns_handle, - handle->zone_pkey, - handle->record_name, - i + j, - rd_new, - &create_finished, - handle); + handle->zone_pkey, + handle->record_name, + i + j, + rd_new, + &create_finished, + handle); if (NULL == handle->ns_qe) { handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); @@ -794,12 +792,12 @@ namestore_add_or_update (struct GNUNET_REST_RequestHandle *con_handle, } handle->zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); handle->ns_qe = GNUNET_NAMESTORE_records_lookup (handle->ns_handle, - handle->zone_pkey, - handle->record_name, - &ns_lookup_error_cb, - handle, - &ns_lookup_cb, - handle); + handle->zone_pkey, + handle->record_name, + &ns_lookup_error_cb, + handle, + &ns_lookup_cb, + handle); if (NULL == handle->ns_qe) { handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); @@ -898,9 +896,9 @@ namestore_delete (struct GNUNET_REST_RequestHandle *con_handle, handle->zone_pkey, handle->record_name, 0, - NULL, - &del_finished, - handle); + NULL, + &del_finished, + handle); if (NULL == handle->ns_qe) { handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); diff --git a/src/nat/gnunet-service-nat_helper.c b/src/nat/gnunet-service-nat_helper.c index 80d3559f3..bd1645d25 100644 --- a/src/nat/gnunet-service-nat_helper.c +++ b/src/nat/gnunet-service-nat_helper.c @@ -222,7 +222,7 @@ restart_nat_server (void *cls) return; } h->server_stdout = - GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES); + GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW); if (NULL == h->server_stdout) { GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "pipe"); diff --git a/src/nat/gnunet-service-nat_mini.c b/src/nat/gnunet-service-nat_mini.c index b98255ad2..24f77d9cc 100644 --- a/src/nat/gnunet-service-nat_mini.c +++ b/src/nat/gnunet-service-nat_mini.c @@ -192,7 +192,7 @@ GNUNET_NAT_mini_get_external_ipv4_ (GNUNET_NAT_IPCallback cb, void *cb_cls) } LOG (GNUNET_ERROR_TYPE_DEBUG, "Running `external-ip' to determine our external IP\n"); - eh->opipe = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES); + eh->opipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW); if (NULL == eh->opipe) { eh->ret = GNUNET_NAT_ERROR_IPC_FAILURE; diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c b/src/reclaim/gnunet-service-reclaim_tickets.c index f170b6d84..7e6b07514 100644 --- a/src/reclaim/gnunet-service-reclaim_tickets.c +++ b/src/reclaim/gnunet-service-reclaim_tickets.c @@ -1292,7 +1292,7 @@ issue_ticket (struct TicketIssueHandle *ih) for (le = ih->attrs->list_head; NULL != le; le = le->next) attrs_count++; - //Worst case we have one attestation per attribute + // Worst case we have one attestation per attribute attrs_record = GNUNET_malloc (2 * attrs_count * sizeof(struct GNUNET_GNSRECORD_Data)); i = 0; diff --git a/src/reclaim/json_reclaim.h b/src/reclaim/json_reclaim.h index 61ddb4378..c57971dcb 100644 --- a/src/reclaim/json_reclaim.h +++ b/src/reclaim/json_reclaim.h @@ -56,4 +56,3 @@ GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket); struct GNUNET_JSON_Specification GNUNET_RECLAIM_JSON_spec_claim_attest (struct GNUNET_RECLAIM_Attestation **attr); - diff --git a/src/reclaim/plugin_reclaim_attribute_basic.c b/src/reclaim/plugin_reclaim_attribute_basic.c index 47fdd5f11..286186a93 100644 --- a/src/reclaim/plugin_reclaim_attribute_basic.c +++ b/src/reclaim/plugin_reclaim_attribute_basic.c @@ -90,6 +90,7 @@ basic_string_to_value (void *cls, } } + /** * Mapping of attribute type numbers to human-readable * attribute type names. diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c index 654df175e..10ee2f801 100644 --- a/src/reclaim/plugin_rest_reclaim.c +++ b/src/reclaim/plugin_rest_reclaim.c @@ -576,7 +576,8 @@ attest_collect (void *cls, if (GNUNET_OK == GNUNET_RECLAIM_attestation_get_expiration (attest, &exp)) { - json_object_set_new (attest_obj, "expiration", json_integer (exp.abs_value_us)); + json_object_set_new (attest_obj, "expiration", json_integer ( + exp.abs_value_us)); } id_str = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id)); @@ -597,7 +598,7 @@ attest_collect (void *cls, json_object_set_new (attr_obj, "name", json_string ( ale->attribute->name)); - json_object_set_new (attr_obj, "flag", json_string ("1")); //FIXME + json_object_set_new (attr_obj, "flag", json_string ("1")); // FIXME type = GNUNET_RECLAIM_attribute_number_to_typename (ale->attribute->type); json_object_set_new (attr_obj, "type", json_string (type)); json_object_set_new (attr_obj, "id", json_string ("")); diff --git a/src/reclaim/reclaim_attestation.c b/src/reclaim/reclaim_attestation.c index bdf80a709..1f2b1890b 100644 --- a/src/reclaim/reclaim_attestation.c +++ b/src/reclaim/reclaim_attestation.c @@ -552,7 +552,7 @@ GNUNET_RECLAIM_attestation_get_issuer (const struct int GNUNET_RECLAIM_attestation_get_expiration (const struct GNUNET_RECLAIM_Attestation *attest, - struct GNUNET_TIME_Absolute* exp) + struct GNUNET_TIME_Absolute*exp) { unsigned int i; struct Plugin *plugin; diff --git a/src/reclaim/reclaim_attribute.c b/src/reclaim/reclaim_attribute.c index 69c5351d3..05bdc1ac6 100644 --- a/src/reclaim/reclaim_attribute.c +++ b/src/reclaim/reclaim_attribute.c @@ -230,7 +230,8 @@ GNUNET_RECLAIM_attribute_value_to_string (uint32_t type, */ struct GNUNET_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_new (const char *attr_name, - const struct GNUNET_RECLAIM_Identifier *attestation, + const struct + GNUNET_RECLAIM_Identifier *attestation, uint32_t type, const void *data, size_t data_size) diff --git a/src/revocation/gnunet-revocation-tvg.c b/src/revocation/gnunet-revocation-tvg.c index b8f462b28..29df1bb4d 100644 --- a/src/revocation/gnunet-revocation-tvg.c +++ b/src/revocation/gnunet-revocation-tvg.c @@ -43,13 +43,14 @@ print_bytes (void *buf, for (i = 0; i < buf_len; i++) { - if ((0 != i) && (0 != fold) && (i%fold == 0)) - printf("\n"); - printf("%02x", ((unsigned char*)buf)[i]); + if ((0 != i) && (0 != fold) && (i % fold == 0)) + printf ("\n"); + printf ("%02x", ((unsigned char*) buf)[i]); } - printf("\n"); + printf ("\n"); } + /** * Main function that will be run. * @@ -73,12 +74,12 @@ run (void *cls, GNUNET_CRYPTO_ecdsa_key_create (&id_priv); GNUNET_CRYPTO_ecdsa_key_get_public (&id_priv, &id_pub); - fprintf(stdout, "Zone private key (d, little-endian scalar):\n"); + fprintf (stdout, "Zone private key (d, little-endian scalar):\n"); print_bytes (&id_priv, sizeof(id_priv), 0); - fprintf(stdout, "\n"); - fprintf(stdout, "Zone public key (zk):\n"); + fprintf (stdout, "\n"); + fprintf (stdout, "Zone public key (zk):\n"); print_bytes (&id_pub, sizeof(id_pub), 0); - fprintf(stdout, "\n"); + fprintf (stdout, "\n"); memset (&pow, 0, sizeof (pow)); GNUNET_REVOCATION_pow_init (&id_priv, &pow); @@ -99,7 +100,7 @@ run (void *cls, GNUNET_assert (GNUNET_OK == GNUNET_REVOCATION_check_pow (&pow, TEST_DIFFICULTY, exp)); - fprintf(stdout, "Proof:\n"); + fprintf (stdout, "Proof:\n"); print_bytes (&pow, sizeof (pow), 8); diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 3815e47b0..e0b195aa9 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c @@ -468,9 +468,9 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, /** * First, check if PoW set is strictly monotically increasing */ - for (unsigned int i = 0; i < POW_COUNT-1; i++) + for (unsigned int i = 0; i < POW_COUNT - 1; i++) { - if (GNUNET_ntohll (pow->pow[i]) >= GNUNET_ntohll (pow->pow[i+1])) + if (GNUNET_ntohll (pow->pow[i]) >= GNUNET_ntohll (pow->pow[i + 1])) return GNUNET_NO; } GNUNET_memcpy (&buf[sizeof(uint64_t)], @@ -592,6 +592,7 @@ GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow, return pc; } + /** * Comparison function for quicksort * @@ -602,9 +603,10 @@ GNUNET_REVOCATION_pow_start (struct GNUNET_REVOCATION_PowP *pow, static int cmp_pow_value (const void *a, const void *b) { - return ( GNUNET_ntohll(*(uint64_t*)a) - GNUNET_ntohll(*(uint64_t*)b)); + return (GNUNET_ntohll (*(uint64_t*) a) - GNUNET_ntohll (*(uint64_t*) b)); } + /** * Calculate a key revocation valid for broadcasting for a number * of epochs. diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index af43a0fa1..08d1d2d34 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c @@ -924,10 +924,10 @@ tofile_ (const char *file_name, const char *line) int size; \ size = GNUNET_snprintf (tmp_buf, sizeof(tmp_buf), __VA_ARGS__); \ if (0 > size) \ - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, \ - "Failed to create tmp_buf\n"); \ + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, \ + "Failed to create tmp_buf\n"); \ else \ - tofile_ (file_name, tmp_buf); \ + tofile_ (file_name, tmp_buf); \ } while (0); diff --git a/src/rps/test_rps.c b/src/rps/test_rps.c index 81cf63c72..a7dc3aa00 100644 --- a/src/rps/test_rps.c +++ b/src/rps/test_rps.c @@ -656,10 +656,10 @@ tofile_ (const char *file_name, const char *line) int size; \ size = GNUNET_snprintf (tmp_buf, sizeof(tmp_buf), __VA_ARGS__); \ if (0 > size) \ - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, \ - "Failed to create tmp_buf\n"); \ + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, \ + "Failed to create tmp_buf\n"); \ else \ - tofile_ (file_name, tmp_buf); \ + tofile_ (file_name, tmp_buf); \ } while (0); diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c index 993cead11..9313483bb 100644 --- a/src/set/gnunet-service-set_intersection.c +++ b/src/set/gnunet-service-set_intersection.c @@ -868,7 +868,7 @@ process_bf (struct Operation *op) GNUNET_CONTAINER_multihashmap_size (op->state->my_elements)); op->state->full_result_iter = GNUNET_CONTAINER_multihashmap_iterator_create ( - op->state->my_elements); + op->state->my_elements); send_remaining_elements (op); return; } diff --git a/src/set/gnunet-service-set_union_strata_estimator.c b/src/set/gnunet-service-set_union_strata_estimator.c index 1101a56a6..97b4a1f98 100644 --- a/src/set/gnunet-service-set_union_strata_estimator.c +++ b/src/set/gnunet-service-set_union_strata_estimator.c @@ -149,7 +149,7 @@ strata_estimator_insert (struct StrataEstimator *se, v = key.key_val; /* count trailing '1'-bits of v */ - for (i = 0; v &1; v >>= 1, i++) + for (i = 0; v & 1; v >>= 1, i++) /* empty */; ibf_insert (se->strata[i], key); } @@ -170,7 +170,7 @@ strata_estimator_remove (struct StrataEstimator *se, v = key.key_val; /* count trailing '1'-bits of v */ - for (i = 0; v &1; v >>= 1, i++) + for (i = 0; v & 1; v >>= 1, i++) /* empty */; ibf_remove (se->strata[i], key); } diff --git a/src/statistics/gnunet-service-statistics.c b/src/statistics/gnunet-service-statistics.c index be2a49201..31c367e91 100644 --- a/src/statistics/gnunet-service-statistics.c +++ b/src/statistics/gnunet-service-statistics.c @@ -290,7 +290,8 @@ save () msg->flags = htonl (pos->persistent ? GNUNET_STATISTICS_SETFLAG_PERSISTENT : 0); msg->value = GNUNET_htonll (pos->value); - if (GNUNET_OK != GNUNET_BIO_write (wh, "statistics-save-msg", msg, size)) + if (GNUNET_OK != GNUNET_BIO_write (wh, "statistics-save-msg", msg, + size)) { GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "write", fn); if (GNUNET_OK != GNUNET_BIO_write_close (wh, NULL)) diff --git a/src/testbed/generate-underlay-topology.c b/src/testbed/generate-underlay-topology.c index 726bed179..97c3c1e67 100644 --- a/src/testbed/generate-underlay-topology.c +++ b/src/testbed/generate-underlay-topology.c @@ -51,12 +51,12 @@ __LINE__, \ sqlite3_errmsg (db)); \ if (msg != NULL) \ - GNUNET_asprintf (msg, \ - _ ("`%s' failed at %s:%u with error: %s"), \ - cmd, \ - __FILE__, \ - __LINE__, \ - sqlite3_errmsg (db)); \ + GNUNET_asprintf (msg, \ + _ ("`%s' failed at %s:%u with error: %s"), \ + cmd, \ + __FILE__, \ + __LINE__, \ + sqlite3_errmsg (db)); \ } while (0) diff --git a/src/testbed/gnunet-daemon-latency-logger.c b/src/testbed/gnunet-daemon-latency-logger.c index c13750db7..cbc9cfdbf 100644 --- a/src/testbed/gnunet-daemon-latency-logger.c +++ b/src/testbed/gnunet-daemon-latency-logger.c @@ -53,8 +53,8 @@ "`%s' failed at %s:%d with error: %s\n"), \ cmd, __FILE__, __LINE__, sqlite3_errmsg (db)); \ if (msg != NULL) \ - GNUNET_asprintf (msg, _ ("`%s' failed at %s:%u with error: %s"), cmd, \ - __FILE__, __LINE__, sqlite3_errmsg (db)); \ + GNUNET_asprintf (msg, _ ("`%s' failed at %s:%u with error: %s"), cmd, \ + __FILE__, __LINE__, sqlite3_errmsg (db)); \ } while (0) diff --git a/src/testbed/gnunet-daemon-testbed-underlay.c b/src/testbed/gnunet-daemon-testbed-underlay.c index 2bff7cdd4..c3b424c9b 100644 --- a/src/testbed/gnunet-daemon-testbed-underlay.c +++ b/src/testbed/gnunet-daemon-testbed-underlay.c @@ -57,8 +57,8 @@ "`%s' failed at %s:%d with error: %s\n"), \ cmd, __FILE__, __LINE__, sqlite3_errmsg (db)); \ if (msg != NULL) \ - GNUNET_asprintf (msg, _ ("`%s' failed at %s:%u with error: %s"), cmd, \ - __FILE__, __LINE__, sqlite3_errmsg (db)); \ + GNUNET_asprintf (msg, _ ("`%s' failed at %s:%u with error: %s"), cmd, \ + __FILE__, __LINE__, sqlite3_errmsg (db)); \ } while (0) diff --git a/src/testbed/gnunet-helper-testbed.c b/src/testbed/gnunet-helper-testbed.c index 03be376fe..5d0c3b048 100644 --- a/src/testbed/gnunet-helper-testbed.c +++ b/src/testbed/gnunet-helper-testbed.c @@ -587,7 +587,7 @@ main (int argc, char **argv) status = GNUNET_OK; if (NULL == - (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO))) + (sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE))) { GNUNET_break (0); return 1; diff --git a/src/testbed/gnunet-service-testbed.h b/src/testbed/gnunet-service-testbed.h index 03955327c..ae477ccb4 100644 --- a/src/testbed/gnunet-service-testbed.h +++ b/src/testbed/gnunet-service-testbed.h @@ -498,7 +498,7 @@ extern char *GST_stats_dir; GNUNET_assert (size <= accommodate_size); \ growth_size = size; \ while (growth_size <= accommodate_size) \ - growth_size += LIST_GROW_STEP; \ + growth_size += LIST_GROW_STEP; \ GNUNET_array_grow (ptr, size, growth_size); \ GNUNET_assert (size > accommodate_size); \ } while (0) diff --git a/src/testbed/gnunet_testbed_mpi_spawn.c b/src/testbed/gnunet_testbed_mpi_spawn.c index 353cc2881..577ffbeba 100644 --- a/src/testbed/gnunet_testbed_mpi_spawn.c +++ b/src/testbed/gnunet_testbed_mpi_spawn.c @@ -299,8 +299,7 @@ main (int argc, char *argv[]) GNUNET_break (0); return 1; } - if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, - GNUNET_NO, GNUNET_NO))) + if (NULL == (sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE))) { GNUNET_break (0); ret = GNUNET_SYSERR; diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c index dd270df17..49f1d9ae9 100644 --- a/src/testbed/test_testbed_api.c +++ b/src/testbed/test_testbed_api.c @@ -163,7 +163,7 @@ do_shutdown (void *cls) if (! (cond)) { \ GNUNET_break (0); \ if (NULL != abort_task) \ - GNUNET_SCHEDULER_cancel (abort_task); \ + GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = NULL; \ GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \ ret; \ diff --git a/src/testbed/test_testbed_api_2peers_1controller.c b/src/testbed/test_testbed_api_2peers_1controller.c index c854d1ccc..4a8b8a584 100644 --- a/src/testbed/test_testbed_api_2peers_1controller.c +++ b/src/testbed/test_testbed_api_2peers_1controller.c @@ -173,7 +173,7 @@ static enum Stage result; if (! (cond)) { \ GNUNET_break (0); \ if (NULL != abort_task) \ - GNUNET_SCHEDULER_cancel (abort_task); \ + GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = NULL; \ GNUNET_SCHEDULER_add_now (do_shutdown, NULL); \ return; \ diff --git a/src/testbed/test_testbed_api_controllerlink.c b/src/testbed/test_testbed_api_controllerlink.c index 16a3f7b91..784407520 100644 --- a/src/testbed/test_testbed_api_controllerlink.c +++ b/src/testbed/test_testbed_api_controllerlink.c @@ -298,7 +298,7 @@ static enum Stage result; { \ GNUNET_break (0); \ if (NULL != abort_task) \ - GNUNET_SCHEDULER_cancel (abort_task); \ + GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = NULL; \ GNUNET_SCHEDULER_shutdown (); \ return; \ diff --git a/src/testbed/test_testbed_api_peer_reconfiguration.c b/src/testbed/test_testbed_api_peer_reconfiguration.c index 91955c13d..22dd46b53 100644 --- a/src/testbed/test_testbed_api_peer_reconfiguration.c +++ b/src/testbed/test_testbed_api_peer_reconfiguration.c @@ -77,7 +77,7 @@ enum if (! (cond)) { \ GNUNET_break (0); \ if (NULL != abort_task) \ - GNUNET_SCHEDULER_cancel (abort_task); \ + GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); \ ret; \ } \ diff --git a/src/testbed/test_testbed_api_peers_manage_services.c b/src/testbed/test_testbed_api_peers_manage_services.c index 6d4f8196a..93b0da550 100644 --- a/src/testbed/test_testbed_api_peers_manage_services.c +++ b/src/testbed/test_testbed_api_peers_manage_services.c @@ -92,7 +92,7 @@ enum if (! (cond)) { \ GNUNET_break (0); \ if (NULL != abort_task) \ - GNUNET_SCHEDULER_cancel (abort_task); \ + GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); \ ret; \ } \ diff --git a/src/testbed/test_testbed_api_statistics.c b/src/testbed/test_testbed_api_statistics.c index dc305d008..4d42cda6a 100644 --- a/src/testbed/test_testbed_api_statistics.c +++ b/src/testbed/test_testbed_api_statistics.c @@ -76,7 +76,7 @@ static unsigned int num_seen_peers; if (! (cond)) { \ GNUNET_break (0); \ if (NULL != abort_task) \ - GNUNET_SCHEDULER_cancel (abort_task); \ + GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = GNUNET_SCHEDULER_add_now (&do_abort, NULL); \ ret; \ } \ diff --git a/src/testbed/test_testbed_api_test.c b/src/testbed/test_testbed_api_test.c index d3fec78d9..aefbd340e 100644 --- a/src/testbed/test_testbed_api_test.c +++ b/src/testbed/test_testbed_api_test.c @@ -90,10 +90,10 @@ do_shutdown (void *cls) if (! (cond)) { \ GNUNET_break (0); \ if (NULL != abort_task) \ - GNUNET_SCHEDULER_cancel (abort_task); \ + GNUNET_SCHEDULER_cancel (abort_task); \ abort_task = NULL; \ if (NULL == shutdown_task) \ - shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); \ + shutdown_task = GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); \ return; \ } \ } while (0) diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index 152762280..95a6bf76f 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c @@ -56,7 +56,7 @@ do \ { \ if (cond) \ - break; \ + break; \ LOG (GNUNET_ERROR_TYPE_ERROR, "API violation detected: %s\n", errstr); \ GNUNET_assert (0); \ } while (0) diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index e25cdf139..177b5c26c 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c @@ -577,7 +577,6 @@ struct Addresses }; - /** * Maximum queue length before we stop reading towards the transport service. */ @@ -1203,6 +1202,7 @@ queue_read (void *cls) queue_finish (queue); } + /** * Convert a `struct sockaddr_in6 to a `struct sockaddr *` * @@ -1234,6 +1234,7 @@ tcp_address_to_sockaddr_numeric_v6 (socklen_t *sock_len, struct sockaddr_in6 v6, return in; } + /** * Convert a `struct sockaddr_in4 to a `struct sockaddr *` * @@ -1257,6 +1258,7 @@ tcp_address_to_sockaddr_numeric_v4 (socklen_t *sock_len, struct sockaddr_in v4, return in; } + /** * Convert TCP bind specification to a `struct PortOnlyIpv4Ipv6 *` * @@ -1318,6 +1320,7 @@ tcp_address_to_sockaddr_port_only (const char *bindto, unsigned int *port) return po; } + /** * This Method extracts the address part of the BINDTO string. * @@ -1344,7 +1347,8 @@ extract_address (const char *bindto) start++; /* skip over '['*/ cp[strlen (cp) - 1] = '\0'; /* eat ']'*/ } - else { + else + { token = strtok_r (cp, "]", &rest); if (strlen (bindto) == strlen (token)) { @@ -1362,6 +1366,7 @@ extract_address (const char *bindto) return start; } + /** * This Method extracts the port part of the BINDTO string. * @@ -1440,6 +1445,7 @@ extract_port (const char *addr_and_port) return port; } + /** * Convert TCP bind specification to a `struct sockaddr *` * @@ -2140,6 +2146,7 @@ queue_read_kx (void *cls) queue->read_task = GNUNET_SCHEDULER_add_now (&queue_read, queue); } + /** * Function called by the transport service to initialize a * message queue given address information about another peer. @@ -2229,6 +2236,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address) return GNUNET_OK; } + /** * Iterator over all message queues to clean up. * @@ -2367,6 +2375,7 @@ nat_address_cb (void *cls, } } + /** * This method launch network interactions for each address we like to bind to. * @@ -2474,7 +2483,7 @@ init_socket (const struct sockaddr *addr, if (NULL == queue_map) queue_map = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); - if (NULL == ch ) + if (NULL == ch) ch = GNUNET_TRANSPORT_communicator_connect (cfg, COMMUNICATOR_CONFIG_SECTION, COMMUNICATOR_ADDRESS_PREFIX, @@ -2496,6 +2505,7 @@ init_socket (const struct sockaddr *addr, } + /** * This method reads from the DLL addrs_head to register them at the NAT service. */ @@ -2557,6 +2567,7 @@ nat_register () } } + /** * This method adds addresses to the DLL, that are later register at the NAT service. */ @@ -2573,6 +2584,7 @@ add_addr (struct sockaddr *in, socklen_t in_len) addrs_lens++; } + /** * This method is the callback called by the resolver API, and wraps method init_socket. * @@ -2625,6 +2637,7 @@ init_socket_resolv (void *cls, } } + /** * Setup communicator and launch network interactions. * diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c index efbbd08a7..03c120cc9 100644 --- a/src/transport/gnunet-communicator-udp.c +++ b/src/transport/gnunet-communicator-udp.c @@ -1309,7 +1309,8 @@ handle_ack (void *cls, const struct GNUNET_PeerIdentity *pid, void *value) "Tell transport we have more acks!\n"); GNUNET_TRANSPORT_communicator_mq_update (ch, receiver->d_qh, - (allowed - ss->sequence_allowed), + (allowed + - ss->sequence_allowed), 1); ss->sequence_allowed = allowed; /* move ss to head to avoid discarding it anytime soon! */ diff --git a/src/transport/gnunet-communicator-unix.c b/src/transport/gnunet-communicator-unix.c index 6ea0ea360..d7e18f87a 100644 --- a/src/transport/gnunet-communicator-unix.c +++ b/src/transport/gnunet-communicator-unix.c @@ -673,7 +673,8 @@ setup_queue (const struct GNUNET_PeerIdentity *target, queue->qh = GNUNET_TRANSPORT_communicator_mq_add (ch, &queue->target, foreign_addr, - UNIX_MTU - sizeof (struct UNIXMessage), + UNIX_MTU - sizeof (struct + UNIXMessage), GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED, 0, GNUNET_NT_LOOPBACK, @@ -799,7 +800,7 @@ select_read_cb (void *cls) /* ensure aligned access */ memcpy (&al_hdr, currhdr, sizeof(al_hdr)); if ((tsize < sizeof(struct GNUNET_MessageHeader)) || - (tsize != ntohs(al_hdr.size))) + (tsize != ntohs (al_hdr.size))) { GNUNET_break_op (0); return; diff --git a/src/transport/plugin_transport_smtp.c b/src/transport/plugin_transport_smtp.c index 330023118..f3db4fc5a 100644 --- a/src/transport/plugin_transport_smtp.c +++ b/src/transport/plugin_transport_smtp.c @@ -174,9 +174,9 @@ listenAndDistribute (void *unused) goto END; \ } \ if (core_api->load_monitor != NULL) \ - GNUNET_network_monitor_notify_transmission (core_api->load_monitor, \ - GNUNET_ND_DOWNLOAD, \ - strlen (retl)); \ + GNUNET_network_monitor_notify_transmission (core_api->load_monitor, \ + GNUNET_ND_DOWNLOAD, \ + strlen (retl)); \ } while (0) diff --git a/src/transport/test_communicator_basic.c b/src/transport/test_communicator_basic.c index 290167960..45c268684 100644 --- a/src/transport/test_communicator_basic.c +++ b/src/transport/test_communicator_basic.c @@ -224,8 +224,8 @@ latency_timeout (void *cls) } LOG (GNUNET_ERROR_TYPE_ERROR, - "Latency too high. Test failed. (Phase: %d. Sent: %lu, Received: %lu)\n", - phase, num_sent, num_received); + "Latency too high. Test failed. (Phase: %d. Sent: %lu, Received: %lu)\n", + phase, num_sent, num_received); ret = 2; GNUNET_SCHEDULER_shutdown (); } @@ -403,7 +403,7 @@ incoming_message_cb (void *cls, if (0 != strcmp ((char*) cls, cfg_peers_name[NUM_PEERS - 1])) { LOG (GNUNET_ERROR_TYPE_WARNING, - "unexpected receiver...\n"); + "unexpected receiver...\n"); return; } /* Reset timeout */ @@ -422,18 +422,18 @@ incoming_message_cb (void *cls, if (num_received == BURST_PACKETS) { LOG (GNUNET_ERROR_TYPE_MESSAGE, - "Short size packet test done.\n"); + "Short size packet test done.\n"); char *goodput = GNUNET_STRINGS_byte_size_fancy ((SHORT_MESSAGE_SIZE * num_received * 1000 * 1000) / duration.rel_value_us); LOG (GNUNET_ERROR_TYPE_MESSAGE, - "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", - (unsigned long) num_received, - (unsigned long) num_sent, - (unsigned long long) duration.rel_value_us, - goodput, - (unsigned long long) avg_latency); + "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", + (unsigned long) num_received, + (unsigned long) num_sent, + (unsigned long long) duration.rel_value_us, + goodput, + (unsigned long long) avg_latency); GNUNET_free (goodput); start_long = GNUNET_TIME_absolute_get (); phase = TP_BURST_LONG; @@ -449,7 +449,7 @@ incoming_message_cb (void *cls, if (long_message_size != payload_len) { LOG (GNUNET_ERROR_TYPE_WARNING, - "Ignoring packet with wrong length\n"); + "Ignoring packet with wrong length\n"); return; // Ignore } num_received++; @@ -458,19 +458,19 @@ incoming_message_cb (void *cls, if (num_received == BURST_PACKETS) { LOG (GNUNET_ERROR_TYPE_MESSAGE, - "Long size packet test done.\n"); + "Long size packet test done.\n"); char *goodput = GNUNET_STRINGS_byte_size_fancy ((long_message_size * num_received * 1000 * 1000) / duration.rel_value_us); LOG (GNUNET_ERROR_TYPE_MESSAGE, - "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", - (unsigned long) num_received, - (unsigned long) num_sent, - (unsigned long long) duration.rel_value_us, - goodput, - (unsigned long long) avg_latency); + "%lu/%lu packets in %llu us (%s/s) -- avg latency: %llu us\n", + (unsigned long) num_received, + (unsigned long) num_sent, + (unsigned long long) duration.rel_value_us, + goodput, + (unsigned long long) avg_latency); GNUNET_free (goodput); ack = 0; phase = TP_SIZE_CHECK; @@ -493,12 +493,12 @@ incoming_message_cb (void *cls, if (num_received >= (max_size) / 10) { LOG (GNUNET_ERROR_TYPE_MESSAGE, - "Size packet test done.\n"); + "Size packet test done.\n"); LOG (GNUNET_ERROR_TYPE_MESSAGE, - "%lu/%lu packets -- avg latency: %llu us\n", - (unsigned long) num_received, - (unsigned long) num_sent, - (unsigned long long) avg_latency); + "%lu/%lu packets -- avg latency: %llu us\n", + (unsigned long) num_received, + (unsigned long) num_sent, + (unsigned long long) avg_latency); num_received = 0; num_sent = 0; avg_latency = 0; @@ -511,7 +511,7 @@ incoming_message_cb (void *cls, break; } LOG (GNUNET_ERROR_TYPE_DEBUG, - "Finished\n"); + "Finished\n"); GNUNET_SCHEDULER_shutdown (); } break; @@ -640,9 +640,9 @@ main (int argc, &peer_id[i].public_key); GNUNET_free (private_key); LOG (GNUNET_ERROR_TYPE_INFO, - "Identity of peer %u is %s\n", - i, - GNUNET_i2s_full (&peer_id[i])); + "Identity of peer %u is %s\n", + i, + GNUNET_i2s_full (&peer_id[i])); } LOG (GNUNET_ERROR_TYPE_MESSAGE, "Starting test...\n"); GNUNET_SCHEDULER_run (&run, diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c index 2a7a1dfcb..772ad9f2d 100644 --- a/src/transport/transport-testing2.c +++ b/src/transport/transport-testing2.c @@ -671,8 +671,8 @@ handle_update_queue_message (void *cls, struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorQueue *tc_queue; LOG (GNUNET_ERROR_TYPE_DEBUG, - "Received queue update message for %u with q_len %"PRIu64"\n", - msg->qid, GNUNET_ntohll(msg->q_len)); + "Received queue update message for %u with q_len %" PRIu64 "\n", + msg->qid, GNUNET_ntohll (msg->q_len)); tc_queue = tc_h->queue_head; if (NULL != tc_queue) { @@ -947,6 +947,7 @@ shutdown_nat (void *cls) shutdown_process (proc); } + /** * @brief Task run at shutdown to kill the resolver process * @@ -959,6 +960,7 @@ shutdown_resolver (void *cls) shutdown_process (proc); } + static void resolver_start (struct GNUNET_TRANSPORT_TESTING_TransportCommunicatorHandle *tc_h) @@ -967,16 +969,17 @@ resolver_start (struct LOG (GNUNET_ERROR_TYPE_DEBUG, "resolver_start\n"); binary = GNUNET_OS_get_libexec_binary_path ("gnunet-service-resolver"); - tc_h->resolver_proc = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_OUT_AND_ERR - | GNUNET_OS_USE_PIPE_CONTROL, - NULL, - NULL, - NULL, - binary, - "gnunet-service-resolver", - "-c", - tc_h->cfg_filename, - NULL); + tc_h->resolver_proc = GNUNET_OS_start_process ( + GNUNET_OS_INHERIT_STD_OUT_AND_ERR + | GNUNET_OS_USE_PIPE_CONTROL, + NULL, + NULL, + NULL, + binary, + "gnunet-service-resolver", + "-c", + tc_h->cfg_filename, + NULL); if (NULL == tc_h->resolver_proc) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to start resolver service!"); @@ -987,6 +990,7 @@ resolver_start (struct } + /** * @brief Start NAT * diff --git a/src/transport/transport.h b/src/transport/transport.h index a64ffd5c6..dbae4ecfb 100644 --- a/src/transport/transport.h +++ b/src/transport/transport.h @@ -903,7 +903,6 @@ struct GNUNET_TRANSPORT_UpdateQueueMessage }; - /** * Remove queue, it is no longer available. */ diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c index cfa144415..d1e28cc36 100644 --- a/src/transport/transport_api2_communication.c +++ b/src/transport/transport_api2_communication.c @@ -420,6 +420,7 @@ send_add_queue (struct GNUNET_TRANSPORT_QueueHandle *qh) GNUNET_MQ_send (qh->ch->mq, env); } + /** * Send message to the transport service about queue @a qh * updated. @@ -446,7 +447,6 @@ send_update_queue (struct GNUNET_TRANSPORT_QueueHandle *qh) } - /** * Send message to the transport service about queue @a qh * being no longer available. @@ -1033,7 +1033,6 @@ GNUNET_TRANSPORT_communicator_mq_update ( } - /** * Notify transport service that an MQ became unavailable due to a * disconnect or timeout. diff --git a/src/util/bio.c b/src/util/bio.c index b27230240..39050bb87 100644 --- a/src/util/bio.c +++ b/src/util/bio.c @@ -260,7 +260,7 @@ read_from_buffer (struct GNUNET_BIO_ReadHandle *h, char *result, size_t len) { - if (h->size < len || h->size - h->pos < len) + if ((h->size < len) || (h->size - h->pos < len)) { GNUNET_asprintf (&h->emsg, _ ("Error while reading `%s' from buffer: %s"), @@ -431,6 +431,7 @@ GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, return GNUNET_OK; } + /** * Read a float. * @@ -439,9 +440,9 @@ GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h, * @param f address of float to read */ int -GNUNET_BIO_read_float(struct GNUNET_BIO_ReadHandle *h, - const char *what, - float *f) +GNUNET_BIO_read_float (struct GNUNET_BIO_ReadHandle *h, + const char *what, + float *f) { int32_t *i = (int32_t *) f; return GNUNET_BIO_read_int32 (h, what, i); @@ -456,9 +457,9 @@ GNUNET_BIO_read_float(struct GNUNET_BIO_ReadHandle *h, * @param f address of double to read */ int -GNUNET_BIO_read_double(struct GNUNET_BIO_ReadHandle *h, - const char *what, - double *f) +GNUNET_BIO_read_double (struct GNUNET_BIO_ReadHandle *h, + const char *what, + double *f) { int64_t *i = (int64_t *) f; return GNUNET_BIO_read_int64 (h, what, i); @@ -692,7 +693,7 @@ GNUNET_BIO_get_buffer_contents (struct GNUNET_BIO_WriteHandle *h, { if (IO_BUFFER != h->type) return GNUNET_SYSERR; - if (NULL == contents || NULL == size) + if ((NULL == contents) || (NULL == size)) return GNUNET_SYSERR; int ret = (NULL != h->emsg) ? GNUNET_SYSERR : GNUNET_OK; if (NULL != emsg) @@ -897,9 +898,9 @@ GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h, * @param f float to write */ int -GNUNET_BIO_write_float(struct GNUNET_BIO_WriteHandle *h, - const char *what, - float f) +GNUNET_BIO_write_float (struct GNUNET_BIO_WriteHandle *h, + const char *what, + float f) { int32_t i = f; return GNUNET_BIO_write_int32 (h, what, i); @@ -914,9 +915,9 @@ GNUNET_BIO_write_float(struct GNUNET_BIO_WriteHandle *h, * @param f double to write */ int -GNUNET_BIO_write_double(struct GNUNET_BIO_WriteHandle *h, - const char *what, - double f) +GNUNET_BIO_write_double (struct GNUNET_BIO_WriteHandle *h, + const char *what, + double f) { int64_t i = f; return GNUNET_BIO_write_int64 (h, what, i); @@ -1196,7 +1197,7 @@ GNUNET_BIO_read_spec_int64 (const char *what, * @param f address of float to read */ struct GNUNET_BIO_ReadSpec -GNUNET_BIO_read_spec_float(const char *what, float *f) +GNUNET_BIO_read_spec_float (const char *what, float *f) { struct GNUNET_BIO_ReadSpec rs = { .rh = &read_spec_handler_int32, @@ -1216,7 +1217,7 @@ GNUNET_BIO_read_spec_float(const char *what, float *f) * @param f address of double to read */ struct GNUNET_BIO_ReadSpec -GNUNET_BIO_read_spec_double(const char *what, double *f) +GNUNET_BIO_read_spec_double (const char *what, double *f) { struct GNUNET_BIO_ReadSpec rs = { .rh = &read_spec_handler_int64, @@ -1243,7 +1244,7 @@ GNUNET_BIO_read_spec_commit (struct GNUNET_BIO_ReadHandle *h, { int ret = GNUNET_OK; - for (size_t i=0; NULL!=rs[i].rh; ++i) + for (size_t i = 0; NULL!=rs[i].rh; ++i) { ret = rs[i].rh (rs[i].cls, h, rs[i].what, rs[i].target, rs[i].size); if (GNUNET_OK != ret) @@ -1490,7 +1491,7 @@ GNUNET_BIO_write_spec_int64 (const char *what, * @return the write spec */ struct GNUNET_BIO_WriteSpec -GNUNET_BIO_write_spec_float(const char *what, float *f) +GNUNET_BIO_write_spec_float (const char *what, float *f) { struct GNUNET_BIO_WriteSpec ws = { .wh = &write_spec_handler_int32, @@ -1512,7 +1513,7 @@ GNUNET_BIO_write_spec_float(const char *what, float *f) * @return the write spec */ struct GNUNET_BIO_WriteSpec -GNUNET_BIO_write_spec_double(const char *what, double *f) +GNUNET_BIO_write_spec_double (const char *what, double *f) { struct GNUNET_BIO_WriteSpec ws = { .wh = &write_spec_handler_int64, @@ -1540,7 +1541,7 @@ GNUNET_BIO_write_spec_commit (struct GNUNET_BIO_WriteHandle *h, { int ret = GNUNET_OK; - for (size_t i=0; NULL!=ws[i].wh; ++i) + for (size_t i = 0; NULL!=ws[i].wh; ++i) { ret = ws[i].wh (ws[i].cls, h, ws[i].what, ws[i].source, ws[i].source_size); if (GNUNET_OK != ret) diff --git a/src/util/configuration.c b/src/util/configuration.c index faee9e3bf..26beacaff 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c @@ -1819,12 +1819,12 @@ GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg, * @return a freshly allocated configuration */ struct GNUNET_CONFIGURATION_Handle * -GNUNET_CONFIGURATION_default(void) +GNUNET_CONFIGURATION_default (void) { const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get (); const struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default (); - GNUNET_OS_init(dpd); + GNUNET_OS_init (dpd); struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); const char *xdg = getenv ("XDG_CONFIG_HOME"); @@ -1835,7 +1835,8 @@ GNUNET_CONFIGURATION_default(void) else cfgname = GNUNET_strdup (pd->user_config_file); - if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfgname)) { + if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfgname)) + { GNUNET_OS_init (pd); GNUNET_CONFIGURATION_destroy (cfg); GNUNET_free (cfgname); diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c index e1608ae55..019dbe94e 100644 --- a/src/util/crypto_ecc.c +++ b/src/util/crypto_ecc.c @@ -141,7 +141,7 @@ decode_private_ecdsa_key (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv) int rc; uint8_t d[32]; - for (size_t i=0; i<32; i++) + for (size_t i = 0; i<32; i++) d[i] = priv->d[31 - i]; rc = gcry_sexp_build (&result, @@ -195,7 +195,7 @@ GNUNET_CRYPTO_eddsa_key_get_public ( struct GNUNET_CRYPTO_EddsaPublicKey *pub) { unsigned char pk[crypto_sign_PUBLICKEYBYTES]; - unsigned char sk[crypto_sign_SECRETKEYBYTES]; + unsigned char sk[crypto_sign_SECRETKEYBYTES]; BENCHMARK_START (eddsa_key_get_public); GNUNET_assert (0 == crypto_sign_seed_keypair (pk, sk, priv->d)); @@ -929,7 +929,7 @@ GNUNET_CRYPTO_ecdsa_private_key_derive ( h = derive_h (&pub, label, context); /* Convert to big endian for libgcrypt */ - for (size_t i=0; i < 32; i++) + for (size_t i = 0; i < 32; i++) dc[i] = priv->d[31 - i]; GNUNET_CRYPTO_mpi_scan_unsigned (&x, dc, sizeof(dc)); d = gcry_mpi_new (256); @@ -941,9 +941,9 @@ GNUNET_CRYPTO_ecdsa_private_key_derive ( ret = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); GNUNET_CRYPTO_mpi_print_unsigned (dc, sizeof(dc), d); /* Convert to big endian for libgcrypt */ - for (size_t i=0; i < 32; i++) + for (size_t i = 0; i < 32; i++) ret->d[i] = dc[31 - i]; - sodium_memzero(dc, sizeof(dc)); + sodium_memzero (dc, sizeof(dc)); gcry_mpi_release (d); return ret; } diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c index 622953476..0dbe9dbe8 100644 --- a/src/util/crypto_hash.c +++ b/src/util/crypto_hash.c @@ -250,12 +250,13 @@ GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode *hc, */ int GNUNET_CRYPTO_hash_get_bit_ltr (const struct GNUNET_HashCode *code, - unsigned int bit) + unsigned int bit) { GNUNET_assert (bit < 8 * sizeof(struct GNUNET_HashCode)); return (((unsigned char *) code)[bit >> 3] & (128 >> (bit & 7))) > 0; } + /** * Obtain a bit from a hashcode. * @param code the GNUNET_CRYPTO_hash to index bit-wise @@ -272,7 +273,6 @@ GNUNET_CRYPTO_hash_get_bit_rtl (const struct GNUNET_HashCode *code, } - /** * Determine how many low order bits match in two * `struct GNUNET_HashCode`s. i.e. - 010011 and 011111 share diff --git a/src/util/crypto_mpi.c b/src/util/crypto_mpi.c index 099921611..6df47c7e1 100644 --- a/src/util/crypto_mpi.c +++ b/src/util/crypto_mpi.c @@ -157,8 +157,8 @@ GNUNET_CRYPTO_mpi_scan_unsigned (gcry_mpi_t *result, */ void GNUNET_CRYPTO_mpi_scan_unsigned_le (gcry_mpi_t *result, - const void *data, - size_t size) + const void *data, + size_t size) { int rc; diff --git a/src/util/disk.c b/src/util/disk.c index cdead59d2..6560726ea 100644 --- a/src/util/disk.c +++ b/src/util/disk.c @@ -1451,33 +1451,23 @@ GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h) /** * Creates an interprocess channel * - * @param blocking_read creates an asynchronous pipe for reading if set to GNUNET_NO - * @param blocking_write creates an asynchronous pipe for writing if set to GNUNET_NO - * @param inherit_read inherit the parent processes stdin (only for windows) - * @param inherit_write inherit the parent processes stdout (only for windows) + * @param pf how to configure the pipe * @return handle to the new pipe, NULL on error */ struct GNUNET_DISK_PipeHandle * -GNUNET_DISK_pipe (int blocking_read, - int blocking_write, - int inherit_read, - int inherit_write) +GNUNET_DISK_pipe (enum GNUNET_DISK_PipeFlags pf) { int fd[2]; - int ret; - int eno; - (void) inherit_read; - (void) inherit_write; - ret = pipe (fd); - if (ret == -1) + if (-1 == pipe (fd)) { - eno = errno; + int eno = errno; + LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "pipe"); errno = eno; return NULL; } - return GNUNET_DISK_pipe_from_fd (blocking_read, blocking_write, fd); + return GNUNET_DISK_pipe_from_fd (pf, fd); } @@ -1485,29 +1475,26 @@ GNUNET_DISK_pipe (int blocking_read, * Creates a pipe object from a couple of file descriptors. * Useful for wrapping existing pipe FDs. * - * @param blocking_read creates an asynchronous pipe for reading if set to GNUNET_NO - * @param blocking_write creates an asynchronous pipe for writing if set to GNUNET_NO + * @param pf how to configure the pipe * @param fd an array of two fd values. One of them may be -1 for read-only or write-only pipes * * @return handle to the new pipe, NULL on error */ struct GNUNET_DISK_PipeHandle * -GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2]) +GNUNET_DISK_pipe_from_fd (enum GNUNET_DISK_PipeFlags pf, + int fd[2]) { struct GNUNET_DISK_PipeHandle *p; - - p = GNUNET_new (struct GNUNET_DISK_PipeHandle); - - int ret; + int ret = 0; int flags; int eno = 0; /* make gcc happy */ - ret = 0; + p = GNUNET_new (struct GNUNET_DISK_PipeHandle); if (fd[0] >= 0) { p->fd[0] = GNUNET_new (struct GNUNET_DISK_FileHandle); p->fd[0]->fd = fd[0]; - if (! blocking_read) + if (0 == (GNUNET_DISK_PF_BLOCKING_READ & pf)) { flags = fcntl (fd[0], F_GETFL); flags |= O_NONBLOCK; @@ -1530,7 +1517,7 @@ GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2]) { p->fd[1] = GNUNET_new (struct GNUNET_DISK_FileHandle); p->fd[1]->fd = fd[1]; - if (! blocking_write) + if (0 == (GNUNET_DISK_PF_BLOCKING_WRITE & pf)) { flags = fcntl (fd[1], F_GETFL); flags |= O_NONBLOCK; @@ -1562,7 +1549,6 @@ GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2]) errno = eno; return NULL; } - return p; } @@ -1572,7 +1558,7 @@ GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2]) * * @param p pipe to close * @param end which end of the pipe to close - * @return GNUNET_OK on success, GNUNET_SYSERR otherwise + * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise */ int GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p, @@ -1644,7 +1630,7 @@ GNUNET_DISK_pipe_detach_end (struct GNUNET_DISK_PipeHandle *p, * Closes an interprocess channel * * @param p pipe to close - * @return GNUNET_OK on success, GNUNET_SYSERR otherwise + * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise */ int GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p) diff --git a/src/util/gnunet-qr.c b/src/util/gnunet-qr.c index 84a3184bc..83b2af2fc 100644 --- a/src/util/gnunet-qr.c +++ b/src/util/gnunet-qr.c @@ -31,7 +31,7 @@ #define LOG(fmt, ...) \ if (verbose) \ - printf (fmt, ## __VA_ARGS__) + printf (fmt, ## __VA_ARGS__) /** * Video device to capture from. Sane default for GNU/Linux systems. @@ -161,10 +161,7 @@ gnunet_uri (void *cls, return; } GNUNET_free (subsystem); - sigpipe = GNUNET_DISK_pipe (GNUNET_NO, - GNUNET_NO, - GNUNET_NO, - GNUNET_NO); + sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE); GNUNET_assert (NULL != sigpipe); rt = GNUNET_SCHEDULER_add_read_file ( GNUNET_TIME_UNIT_FOREVER_REL, diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c index f8754a6d1..9443c9120 100644 --- a/src/util/gnunet-uri.c +++ b/src/util/gnunet-uri.c @@ -167,7 +167,7 @@ main (int argc, char *const *argv) if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) return 2; - sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO); + sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE); GNUNET_assert (sigpipe != NULL); shc_chld = GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); diff --git a/src/util/helper.c b/src/util/helper.c index 7985f2eca..7360b7d4b 100644 --- a/src/util/helper.c +++ b/src/util/helper.c @@ -401,9 +401,9 @@ static void start_helper (struct GNUNET_HELPER_Handle *h) { h->helper_in = - GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_YES, GNUNET_NO); + GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW); h->helper_out = - GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES); + GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW); if ((h->helper_in == NULL) || (h->helper_out == NULL)) { /* out of file descriptors? try again later... */ @@ -423,7 +423,8 @@ start_helper (struct GNUNET_HELPER_Handle *h) h->fh_to_helper = GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); h->helper_proc = GNUNET_OS_start_process_vap (h->with_control_pipe - ? GNUNET_OS_INHERIT_STD_ERR | GNUNET_OS_USE_PIPE_CONTROL + ? GNUNET_OS_INHERIT_STD_ERR + | GNUNET_OS_USE_PIPE_CONTROL : GNUNET_OS_INHERIT_STD_ERR, h->helper_in, h->helper_out, diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 2f86f792f..8d045c72b 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c @@ -376,7 +376,7 @@ start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance, struct GNUNET_DISK_PipeHandle *childpipe; int dup_childpipe_read_fd = -1; - childpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_YES, GNUNET_NO); + childpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE); if (NULL == childpipe) return NULL; childpipe_read = @@ -1152,7 +1152,7 @@ GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc, struct GNUNET_DISK_PipeHandle *opipe; va_list ap; - opipe = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES); + opipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW); if (NULL == opipe) return NULL; va_start (ap, binary); diff --git a/src/util/perf_malloc.c b/src/util/perf_malloc.c index 6582505c8..1c91402da 100644 --- a/src/util/perf_malloc.c +++ b/src/util/perf_malloc.c @@ -56,11 +56,11 @@ perf_realloc () ptr = GNUNET_malloc (i); memset (ptr, 1, i); ptr = GNUNET_realloc (ptr, i + 5); - for (size_t j=0;jagpl_url) - ? GNUNET_MQ_copy_handlers (handlers) - : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL); + ? GNUNET_MQ_copy_handlers (handlers) + : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL); sh.service_name = service_name; sh.ret = 0; /* setup subsystems */ diff --git a/src/util/strings.c b/src/util/strings.c index 5148d0368..41180dd71 100644 --- a/src/util/strings.c +++ b/src/util/strings.c @@ -1985,7 +1985,7 @@ GNUNET_STRINGS_base64_decode (const char *data, size_t len, void **out) "ignoring CR/LF\n"); \ i++; \ if (i >= len) \ - goto END; \ + goto END; \ } GNUNET_assert (len / 3 < SIZE_MAX); diff --git a/src/util/test_bio.c b/src/util/test_bio.c index 0c8453121..f18014719 100644 --- a/src/util/test_bio.c +++ b/src/util/test_bio.c @@ -52,14 +52,14 @@ test_normal_rw (void) GNUNET_BIO_write_spec_string ("test-normal-rw-string", TESTSTRING), GNUNET_BIO_write_spec_meta_data ("test-normal-rw-metadata", mdW), GNUNET_BIO_write_spec_int64 ("test-normal-rw-int64", &wNum), - GNUNET_BIO_write_spec_end(), + GNUNET_BIO_write_spec_end (), }; struct GNUNET_BIO_ReadSpec rs[] = { GNUNET_BIO_read_spec_string ("test-normal-rw-string", &rString, 200), GNUNET_BIO_read_spec_meta_data ("test-normal-rw-metadata", &mdR), GNUNET_BIO_read_spec_int64 ("test-normal-rw-int64", &rNum), - GNUNET_BIO_read_spec_end(), + GNUNET_BIO_read_spec_end (), }; /* I/O on file */ @@ -73,12 +73,13 @@ test_normal_rw (void) GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_spec_commit (rh, rs)); GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_close (rh, NULL)); GNUNET_assert (0 == strcmp (TESTSTRING, rString)); - GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_meta_data_test_equal (mdR, mdW)); + GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_meta_data_test_equal (mdR, + mdW)); GNUNET_assert (wNum == rNum); GNUNET_CONTAINER_meta_data_destroy (mdR); GNUNET_assert (GNUNET_OK == GNUNET_DISK_directory_remove (filename)); - GNUNET_free(filename); + GNUNET_free (filename); /* I/O on buffer */ wh = GNUNET_BIO_write_open_buffer (); @@ -96,7 +97,8 @@ test_normal_rw (void) GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_spec_commit (rh, rs)); GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_close (rh, NULL)); GNUNET_assert (0 == strcmp (TESTSTRING, rString)); - GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_meta_data_test_equal (mdR, mdW)); + GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_meta_data_test_equal (mdR, + mdW)); GNUNET_assert (wNum == rNum); GNUNET_free (buffer); @@ -314,7 +316,7 @@ test_fullfile_rw (void) 200), GNUNET_BIO_read_spec_meta_data ("test-fullfile-rw-metadata", &mdR), - GNUNET_BIO_read_spec_end(), + GNUNET_BIO_read_spec_end (), }; wh = GNUNET_BIO_write_open_file ("/dev/full"); diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c index ce1cdadd6..79cf9d53a 100644 --- a/src/util/test_common_logging_runtime_loglevels.c +++ b/src/util/test_common_logging_runtime_loglevels.c @@ -207,7 +207,7 @@ read_output_line (int phase_from1, int phase_to1, int phase_from2, */ #define LOG_MAX_LINE_LENGTH (17) -#define LOG_BUFFER_SIZE LOG_MAX_NUM_LINES * LOG_MAX_LINE_LENGTH +#define LOG_BUFFER_SIZE LOG_MAX_NUM_LINES *LOG_MAX_LINE_LENGTH static char buf[LOG_BUFFER_SIZE]; @@ -347,8 +347,7 @@ runone () { const struct GNUNET_DISK_FileHandle *stdout_read_handle; - pipe_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, - GNUNET_YES); + pipe_stdout = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW); if (pipe_stdout == NULL) { diff --git a/src/util/test_container_multihashmap.c b/src/util/test_container_multihashmap.c index bd9e7af31..f46b9f56e 100644 --- a/src/util/test_container_multihashmap.c +++ b/src/util/test_container_multihashmap.c @@ -31,7 +31,7 @@ if (m != NULL) GNUNET_CONTAINER_multihashmap_destroy (m); \ if (NULL != \ iter) \ - GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); \ + GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); \ return 1; } #define CHECK(c) { if (! (c)) ABORT (); } diff --git a/src/util/test_container_multipeermap.c b/src/util/test_container_multipeermap.c index 9aeead56c..cb6fc30d2 100644 --- a/src/util/test_container_multipeermap.c +++ b/src/util/test_container_multipeermap.c @@ -31,7 +31,7 @@ if (NULL != m) GNUNET_CONTAINER_multipeermap_destroy (m); \ if (NULL != \ iter) \ - GNUNET_CONTAINER_multipeermap_iterator_destroy (iter); \ + GNUNET_CONTAINER_multipeermap_iterator_destroy (iter); \ return 1; } #define CHECK(c) { if (! (c)) ABORT (); } diff --git a/src/util/test_scheduler.c b/src/util/test_scheduler.c index 471ca64e5..0e2e7f760 100644 --- a/src/util/test_scheduler.c +++ b/src/util/test_scheduler.c @@ -133,7 +133,7 @@ task4 (void *cls) GNUNET_assert (4 == *ok); (*ok) = 6; - p = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO); + p = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE); GNUNET_assert (NULL != p); fds[0] = GNUNET_DISK_pipe_handle (p, GNUNET_DISK_PIPE_END_READ); fds[1] = GNUNET_DISK_pipe_handle (p, GNUNET_DISK_PIPE_END_WRITE); -- cgit v1.2.3