diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-06-19 21:25:50 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-06-19 21:30:25 +0200 |
commit | 2111b3716776f2a1e6e6b38888c8dea42907c09d (patch) | |
tree | 325c76317c007e2af7533488a31e410518f0ab18 /src/core/gnunet-core.c | |
parent | 9baf882d7642f8aeac734ffd16c8e94bd409a41b (diff) | |
download | gnunet-2111b3716776f2a1e6e6b38888c8dea42907c09d.tar.gz gnunet-2111b3716776f2a1e6e6b38888c8dea42907c09d.zip |
fix compiler warnings about unused args
Diffstat (limited to 'src/core/gnunet-core.c')
-rw-r--r-- | src/core/gnunet-core.c | 80 |
1 files changed, 42 insertions, 38 deletions
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; | |||
48 | static void | 48 | static void |
49 | shutdown_task (void *cls) | 49 | shutdown_task (void *cls) |
50 | { | 50 | { |
51 | (void) cls; | ||
51 | if (NULL != mh) | 52 | if (NULL != mh) |
52 | { | 53 | { |
53 | GNUNET_CORE_monitor_stop (mh); | 54 | GNUNET_CORE_monitor_stop (mh); |
@@ -71,13 +72,13 @@ monitor_cb (void *cls, | |||
71 | enum GNUNET_CORE_KxState state, | 72 | enum GNUNET_CORE_KxState state, |
72 | struct GNUNET_TIME_Absolute timeout) | 73 | struct GNUNET_TIME_Absolute timeout) |
73 | { | 74 | { |
74 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get(); | 75 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
75 | const char *now_str; | 76 | const char *now_str; |
76 | const char *state_str; | 77 | const char *state_str; |
77 | 78 | ||
78 | if ( ( (NULL == peer) || | 79 | (void) cls; |
79 | (GNUNET_CORE_KX_ITERATION_FINISHED == state) ) && | 80 | if (((NULL == peer) || (GNUNET_CORE_KX_ITERATION_FINISHED == state)) && |
80 | (GNUNET_NO == monitor_connections) ) | 81 | (GNUNET_NO == monitor_connections)) |
81 | { | 82 | { |
82 | GNUNET_SCHEDULER_shutdown (); | 83 | GNUNET_SCHEDULER_shutdown (); |
83 | return; | 84 | return; |
@@ -87,42 +88,43 @@ monitor_cb (void *cls, | |||
87 | { | 88 | { |
88 | case GNUNET_CORE_KX_STATE_DOWN: | 89 | case GNUNET_CORE_KX_STATE_DOWN: |
89 | /* should never happen, as we immediately send the key */ | 90 | /* should never happen, as we immediately send the key */ |
90 | state_str = _("fresh connection"); | 91 | state_str = _ ("fresh connection"); |
91 | break; | 92 | break; |
92 | case GNUNET_CORE_KX_STATE_KEY_SENT: | 93 | case GNUNET_CORE_KX_STATE_KEY_SENT: |
93 | state_str = _("key sent"); | 94 | state_str = _ ("key sent"); |
94 | break; | 95 | break; |
95 | case GNUNET_CORE_KX_STATE_KEY_RECEIVED: | 96 | case GNUNET_CORE_KX_STATE_KEY_RECEIVED: |
96 | state_str = _("key received"); | 97 | state_str = _ ("key received"); |
97 | break; | 98 | break; |
98 | case GNUNET_CORE_KX_STATE_UP: | 99 | case GNUNET_CORE_KX_STATE_UP: |
99 | state_str = _("connection established"); | 100 | state_str = _ ("connection established"); |
100 | break; | 101 | break; |
101 | case GNUNET_CORE_KX_STATE_REKEY_SENT: | 102 | case GNUNET_CORE_KX_STATE_REKEY_SENT: |
102 | state_str = _("rekeying"); | 103 | state_str = _ ("rekeying"); |
103 | break; | 104 | break; |
104 | case GNUNET_CORE_KX_PEER_DISCONNECT: | 105 | case GNUNET_CORE_KX_PEER_DISCONNECT: |
105 | state_str = _("disconnected"); | 106 | state_str = _ ("disconnected"); |
106 | break; | 107 | break; |
107 | case GNUNET_CORE_KX_ITERATION_FINISHED: | 108 | case GNUNET_CORE_KX_ITERATION_FINISHED: |
108 | return; | 109 | return; |
109 | case GNUNET_CORE_KX_CORE_DISCONNECT: | 110 | case GNUNET_CORE_KX_CORE_DISCONNECT: |
110 | FPRINTF (stderr, | 111 | FPRINTF (stderr, |
111 | "%s\n", | 112 | "%s\n", |
112 | _("Connection to CORE service lost (reconnecting)")); | 113 | _ ("Connection to CORE service lost (reconnecting)")); |
113 | return; | 114 | return; |
114 | default: | 115 | default: |
115 | state_str = _("unknown state"); | 116 | state_str = _ ("unknown state"); |
116 | break; | 117 | break; |
117 | } | 118 | } |
118 | now_str = GNUNET_STRINGS_absolute_time_to_string (now); | 119 | now_str = GNUNET_STRINGS_absolute_time_to_string (now); |
119 | FPRINTF (stdout, | 120 | FPRINTF (stdout, |
120 | _("%24s: %-30s %4s (timeout in %6s)\n"), | 121 | _ ("%24s: %-30s %4s (timeout in %6s)\n"), |
121 | now_str, | 122 | now_str, |
122 | state_str, | 123 | state_str, |
123 | GNUNET_i2s (peer), | 124 | GNUNET_i2s (peer), |
124 | GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_remaining (timeout), | 125 | GNUNET_STRINGS_relative_time_to_string ( |
125 | GNUNET_YES)); | 126 | GNUNET_TIME_absolute_get_remaining (timeout), |
127 | GNUNET_YES)); | ||
126 | } | 128 | } |
127 | 129 | ||
128 | 130 | ||
@@ -135,24 +137,22 @@ monitor_cb (void *cls, | |||
135 | * @param cfg configuration | 137 | * @param cfg configuration |
136 | */ | 138 | */ |
137 | static void | 139 | static void |
138 | run (void *cls, char *const *args, const char *cfgfile, | 140 | run (void *cls, |
141 | char *const *args, | ||
142 | const char *cfgfile, | ||
139 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 143 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
140 | { | 144 | { |
145 | (void) cls; | ||
146 | (void) cfgfile; | ||
141 | if (NULL != args[0]) | 147 | if (NULL != args[0]) |
142 | { | 148 | { |
143 | FPRINTF (stderr, | 149 | FPRINTF (stderr, _ ("Invalid command line argument `%s'\n"), args[0]); |
144 | _("Invalid command line argument `%s'\n"), | ||
145 | args[0]); | ||
146 | return; | 150 | return; |
147 | } | 151 | } |
148 | mh = GNUNET_CORE_monitor_start (cfg, | 152 | mh = GNUNET_CORE_monitor_start (cfg, &monitor_cb, NULL); |
149 | &monitor_cb, | ||
150 | NULL); | ||
151 | if (NULL == mh) | 153 | if (NULL == mh) |
152 | { | 154 | { |
153 | FPRINTF (stderr, | 155 | FPRINTF (stderr, "%s", _ ("Failed to connect to CORE service!\n")); |
154 | "%s", | ||
155 | _("Failed to connect to CORE service!\n")); | ||
156 | return; | 156 | return; |
157 | } | 157 | } |
158 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); | 158 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); |
@@ -167,24 +167,28 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
167 | * @return 0 ok, 1 on error | 167 | * @return 0 ok, 1 on error |
168 | */ | 168 | */ |
169 | int | 169 | int |
170 | main (int argc, | 170 | main (int argc, char *const *argv) |
171 | char *const *argv) | ||
172 | { | 171 | { |
173 | int res; | 172 | int res; |
174 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 173 | struct GNUNET_GETOPT_CommandLineOption options[] = |
175 | GNUNET_GETOPT_option_flag ('m', | 174 | {GNUNET_GETOPT_option_flag ( |
176 | "monitor", | 175 | 'm', |
177 | gettext_noop ("provide information about all current connections (continuously)"), | 176 | "monitor", |
178 | &monitor_connections), | 177 | gettext_noop ( |
179 | GNUNET_GETOPT_OPTION_END | 178 | "provide information about all current connections (continuously)"), |
180 | }; | 179 | &monitor_connections), |
180 | GNUNET_GETOPT_OPTION_END}; | ||
181 | 181 | ||
182 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 182 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
183 | return 2; | 183 | return 2; |
184 | res = GNUNET_PROGRAM_run (argc, argv, "gnunet-core", | 184 | res = GNUNET_PROGRAM_run (argc, |
185 | gettext_noop | 185 | argv, |
186 | ("Print information about connected peers."), | 186 | "gnunet-core", |
187 | options, &run, NULL); | 187 | gettext_noop ( |
188 | "Print information about connected peers."), | ||
189 | options, | ||
190 | &run, | ||
191 | NULL); | ||
188 | 192 | ||
189 | GNUNET_free ((void *) argv); | 193 | GNUNET_free ((void *) argv); |
190 | if (GNUNET_OK == res) | 194 | if (GNUNET_OK == res) |