summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-06-19 21:25:50 +0200
committerChristian Grothoff <christian@grothoff.org>2019-06-19 21:30:25 +0200
commit2111b3716776f2a1e6e6b38888c8dea42907c09d (patch)
tree325c76317c007e2af7533488a31e410518f0ab18
parent9baf882d7642f8aeac734ffd16c8e94bd409a41b (diff)
fix compiler warnings about unused args
-rw-r--r--src/core/core_api.c5
-rw-r--r--src/core/core_api_monitor_peers.c34
-rw-r--r--src/core/gnunet-core.c80
-rw-r--r--src/nse/gnunet-service-nse.c21
4 files changed, 78 insertions, 62 deletions
diff --git a/src/core/core_api.c b/src/core/core_api.c
index 6381d9097..223677a5b 100644
--- a/src/core/core_api.c
+++ b/src/core/core_api.c
@@ -341,6 +341,7 @@ core_mq_cancel_impl (struct GNUNET_MQ_Handle *mq, void *impl_state)
{
struct PeerRecord *pr = impl_state;
+ (void) mq;
GNUNET_assert (NULL != pr->env);
GNUNET_MQ_discard (pr->env);
pr->env = NULL;
@@ -359,7 +360,8 @@ static void
core_mq_error_handler (void *cls, enum GNUNET_MQ_Error error)
{
/* struct PeerRecord *pr = cls; */
-
+ (void) cls;
+ (void) error;
GNUNET_break_op (0);
}
@@ -530,6 +532,7 @@ check_notify_inbound (void *cls, const struct NotifyTrafficMessage *ntm)
uint16_t msize;
const struct GNUNET_MessageHeader *em;
+ (void) cls;
msize = ntohs (ntm->header.size) - sizeof (struct NotifyTrafficMessage);
if (msize < sizeof (struct GNUNET_MessageHeader))
{
diff --git a/src/core/core_api_monitor_peers.c b/src/core/core_api_monitor_peers.c
index 0ebb94d7b..165f741d2 100644
--- a/src/core/core_api_monitor_peers.c
+++ b/src/core/core_api_monitor_peers.c
@@ -54,7 +54,6 @@ struct GNUNET_CORE_MonitorHandle
* Closure for @e peer_cb.
*/
void *peer_cb_cls;
-
};
@@ -77,11 +76,11 @@ reconnect (struct GNUNET_CORE_MonitorHandle *mh);
* @param error error code
*/
static void
-handle_mq_error (void *cls,
- enum GNUNET_MQ_Error error)
+handle_mq_error (void *cls, enum GNUNET_MQ_Error error)
{
struct GNUNET_CORE_MonitorHandle *mh = cls;
+ (void) error;
reconnect (mh);
}
@@ -93,8 +92,7 @@ handle_mq_error (void *cls,
* @param mon_message monitor message
*/
static void
-handle_receive_info (void *cls,
- const struct MonitorNotifyMessage *mon_message)
+handle_receive_info (void *cls, const struct MonitorNotifyMessage *mon_message)
{
struct GNUNET_CORE_MonitorHandle *mh = cls;
@@ -114,24 +112,20 @@ handle_receive_info (void *cls,
static void
reconnect (struct GNUNET_CORE_MonitorHandle *mh)
{
- struct GNUNET_MQ_MessageHandler handlers[] = {
- GNUNET_MQ_hd_fixed_size (receive_info,
- GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY,
- struct MonitorNotifyMessage,
- mh),
- GNUNET_MQ_handler_end ()
- };
+ struct GNUNET_MQ_MessageHandler handlers[] =
+ {GNUNET_MQ_hd_fixed_size (receive_info,
+ GNUNET_MESSAGE_TYPE_CORE_MONITOR_NOTIFY,
+ struct MonitorNotifyMessage,
+ mh),
+ GNUNET_MQ_handler_end ()};
struct GNUNET_MQ_Envelope *env;
struct GNUNET_MessageHeader *msg;
if (NULL != mh->mq)
GNUNET_MQ_destroy (mh->mq);
/* FIXME: use backoff? */
- mh->mq = GNUNET_CLIENT_connect (mh->cfg,
- "core",
- handlers,
- &handle_mq_error,
- mh);
+ mh->mq =
+ GNUNET_CLIENT_connect (mh->cfg, "core", handlers, &handle_mq_error, mh);
if (NULL == mh->mq)
return;
/* notify callback about reconnect */
@@ -140,10 +134,8 @@ reconnect (struct GNUNET_CORE_MonitorHandle *mh)
NULL,
GNUNET_CORE_KX_CORE_DISCONNECT,
GNUNET_TIME_UNIT_FOREVER_ABS);
- env = GNUNET_MQ_msg (msg,
- GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS);
- GNUNET_MQ_send (mh->mq,
- env);
+ env = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_CORE_MONITOR_PEERS);
+ GNUNET_MQ_send (mh->mq, env);
}
diff --git a/src/core/gnunet-core.c b/src/core/gnunet-core.c
index 7180754a9..674da705a 100644
--- a/src/core/gnunet-core.c
+++ b/src/core/gnunet-core.c
@@ -48,6 +48,7 @@ static struct GNUNET_CORE_MonitorHandle *mh;
static void
shutdown_task (void *cls)
{
+ (void) cls;
if (NULL != mh)
{
GNUNET_CORE_monitor_stop (mh);
@@ -71,13 +72,13 @@ monitor_cb (void *cls,
enum GNUNET_CORE_KxState state,
struct GNUNET_TIME_Absolute timeout)
{
- struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get();
+ struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
const char *now_str;
const char *state_str;
- if ( ( (NULL == peer) ||
- (GNUNET_CORE_KX_ITERATION_FINISHED == state) ) &&
- (GNUNET_NO == monitor_connections) )
+ (void) cls;
+ if (((NULL == peer) || (GNUNET_CORE_KX_ITERATION_FINISHED == state)) &&
+ (GNUNET_NO == monitor_connections))
{
GNUNET_SCHEDULER_shutdown ();
return;
@@ -87,42 +88,43 @@ monitor_cb (void *cls,
{
case GNUNET_CORE_KX_STATE_DOWN:
/* should never happen, as we immediately send the key */
- state_str = _("fresh connection");
+ state_str = _ ("fresh connection");
break;
case GNUNET_CORE_KX_STATE_KEY_SENT:
- state_str = _("key sent");
+ state_str = _ ("key sent");
break;
case GNUNET_CORE_KX_STATE_KEY_RECEIVED:
- state_str = _("key received");
+ state_str = _ ("key received");
break;
case GNUNET_CORE_KX_STATE_UP:
- state_str = _("connection established");
+ state_str = _ ("connection established");
break;
case GNUNET_CORE_KX_STATE_REKEY_SENT:
- state_str = _("rekeying");
+ state_str = _ ("rekeying");
break;
case GNUNET_CORE_KX_PEER_DISCONNECT:
- state_str = _("disconnected");
+ state_str = _ ("disconnected");
break;
case GNUNET_CORE_KX_ITERATION_FINISHED:
return;
case GNUNET_CORE_KX_CORE_DISCONNECT:
FPRINTF (stderr,
"%s\n",
- _("Connection to CORE service lost (reconnecting)"));
+ _ ("Connection to CORE service lost (reconnecting)"));
return;
default:
- state_str = _("unknown state");
+ state_str = _ ("unknown state");
break;
}
now_str = GNUNET_STRINGS_absolute_time_to_string (now);
FPRINTF (stdout,
- _("%24s: %-30s %4s (timeout in %6s)\n"),
+ _ ("%24s: %-30s %4s (timeout in %6s)\n"),
now_str,
state_str,
GNUNET_i2s (peer),
- GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (timeout),
- GNUNET_YES));
+ GNUNET_STRINGS_relative_time_to_string (
+ GNUNET_TIME_absolute_get_remaining (timeout),
+ GNUNET_YES));
}
@@ -135,24 +137,22 @@ monitor_cb (void *cls,
* @param cfg configuration
*/
static void
-run (void *cls, char *const *args, const char *cfgfile,
+run (void *cls,
+ char *const *args,
+ const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
+ (void) cls;
+ (void) cfgfile;
if (NULL != args[0])
{
- FPRINTF (stderr,
- _("Invalid command line argument `%s'\n"),
- args[0]);
+ FPRINTF (stderr, _ ("Invalid command line argument `%s'\n"), args[0]);
return;
}
- mh = GNUNET_CORE_monitor_start (cfg,
- &monitor_cb,
- NULL);
+ mh = GNUNET_CORE_monitor_start (cfg, &monitor_cb, NULL);
if (NULL == mh)
{
- FPRINTF (stderr,
- "%s",
- _("Failed to connect to CORE service!\n"));
+ FPRINTF (stderr, "%s", _ ("Failed to connect to CORE service!\n"));
return;
}
GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
@@ -167,24 +167,28 @@ run (void *cls, char *const *args, const char *cfgfile,
* @return 0 ok, 1 on error
*/
int
-main (int argc,
- char *const *argv)
+main (int argc, char *const *argv)
{
int res;
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_option_flag ('m',
- "monitor",
- gettext_noop ("provide information about all current connections (continuously)"),
- &monitor_connections),
- GNUNET_GETOPT_OPTION_END
- };
+ struct GNUNET_GETOPT_CommandLineOption options[] =
+ {GNUNET_GETOPT_option_flag (
+ 'm',
+ "monitor",
+ gettext_noop (
+ "provide information about all current connections (continuously)"),
+ &monitor_connections),
+ GNUNET_GETOPT_OPTION_END};
if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
return 2;
- res = GNUNET_PROGRAM_run (argc, argv, "gnunet-core",
- gettext_noop
- ("Print information about connected peers."),
- options, &run, NULL);
+ res = GNUNET_PROGRAM_run (argc,
+ argv,
+ "gnunet-core",
+ gettext_noop (
+ "Print information about connected peers."),
+ options,
+ &run,
+ NULL);
GNUNET_free ((void *) argv);
if (GNUNET_OK == res)
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index 09316dbcf..fd83d2b67 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -430,6 +430,7 @@ handle_start (void *cls, const struct GNUNET_MessageHeader *message)
struct GNUNET_NSE_ClientMessage em;
struct GNUNET_MQ_Envelope *env;
+ (void) message;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received START message from client\n");
mq = GNUNET_SERVICE_client_get_mq (client);
GNUNET_notification_context_add (nc, mq);
@@ -717,6 +718,8 @@ schedule_current_round (void *cls,
struct NSEPeerEntry *peer_entry = value;
struct GNUNET_TIME_Relative delay;
+ (void) cls;
+ (void) key;
if (NULL != peer_entry->transmit_task)
{
GNUNET_SCHEDULER_cancel (peer_entry->transmit_task);
@@ -749,8 +752,8 @@ static void
update_flood_message (void *cls)
{
struct GNUNET_TIME_Relative offset;
- unsigned int i;
+ (void) cls;
flood_task = NULL;
offset = GNUNET_TIME_absolute_get_remaining (next_timestamp);
if (0 != offset.rel_value_us)
@@ -780,7 +783,7 @@ update_flood_message (void *cls)
setup_flood_message (estimate_index, current_timestamp);
next_message.matching_bits = htonl (0); /* reset for 'next' round */
hop_count_max = 0;
- for (i = 0; i < HISTORY_SIZE; i++)
+ for (unsigned int i = 0; i < HISTORY_SIZE; i++)
hop_count_max =
GNUNET_MAX (ntohl (size_estimate_messages[i].hop_count), hop_count_max);
GNUNET_CONTAINER_multipeermap_iterate (peers, &schedule_current_round, NULL);
@@ -869,6 +872,7 @@ find_proof (void *cls)
struct GNUNET_HashCode result;
unsigned int i;
+ (void) cls;
proof_task = NULL;
GNUNET_memcpy (&buf[sizeof (uint64_t)],
&my_identity,
@@ -967,6 +971,7 @@ update_flood_times (void *cls,
struct NSEPeerEntry *peer_entry = value;
struct GNUNET_TIME_Relative delay;
+ (void) key;
if (peer_entry == exclude)
return GNUNET_OK; /* trigger of the update */
if (GNUNET_NO == peer_entry->previous_round)
@@ -1178,6 +1183,7 @@ handle_core_connect (void *cls,
{
struct NSEPeerEntry *peer_entry;
+ (void) cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer `%s' connected to us\n",
GNUNET_i2s (peer));
@@ -1217,6 +1223,7 @@ handle_core_disconnect (void *cls,
{
struct NSEPeerEntry *pos = internal_cls;
+ (void) cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Peer `%s' disconnected from us\n",
GNUNET_i2s (peer));
@@ -1243,6 +1250,8 @@ handle_core_disconnect (void *cls,
static void
flush_comp_cb (void *cls, size_t size)
{
+ (void) cls;
+ (void) size;
GNUNET_TESTBED_LOGGER_disconnect (lh);
lh = NULL;
}
@@ -1257,6 +1266,7 @@ flush_comp_cb (void *cls, size_t size)
static void
shutdown_task (void *cls)
{
+ (void) cls;
if (NULL != flood_task)
{
GNUNET_SCHEDULER_cancel (flood_task);
@@ -1324,6 +1334,7 @@ core_init (void *cls, const struct GNUNET_PeerIdentity *identity)
struct GNUNET_TIME_Absolute now;
struct GNUNET_TIME_Absolute prev_time;
+ (void) cls;
if (NULL == identity)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Connection to core FAILED!\n");
@@ -1365,6 +1376,7 @@ core_init (void *cls, const struct GNUNET_PeerIdentity *identity)
static void
status_cb (void *cls, int status)
{
+ (void) cls;
logger_test = NULL;
if (GNUNET_YES != status)
{
@@ -1402,6 +1414,8 @@ run (void *cls,
char *proof;
struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
+ (void) cls;
+ (void) service;
cfg = c;
if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_time (cfg,
"NSE",
@@ -1524,6 +1538,8 @@ client_connect_cb (void *cls,
struct GNUNET_SERVICE_Client *c,
struct GNUNET_MQ_Handle *mq)
{
+ (void) cls;
+ (void) mq;
return c;
}
@@ -1540,6 +1556,7 @@ client_disconnect_cb (void *cls,
struct GNUNET_SERVICE_Client *c,
void *internal_cls)
{
+ (void) cls;
GNUNET_assert (c == internal_cls);
}