aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2022-08-10 20:58:08 +0200
committerChristian Grothoff <christian@grothoff.org>2022-08-10 20:58:24 +0200
commite9023bbcf93e35bee6e14c9d32b7ac223dcdd48f (patch)
tree10a6f81ab36d6fb5b4fe39076a15840ca8e93fd4
parent4fd0ca3f103310e74066fce93e569b386dd14662 (diff)
downloadgnunet-e9023bbcf93e35bee6e14c9d32b7ac223dcdd48f.tar.gz
gnunet-e9023bbcf93e35bee6e14c9d32b7ac223dcdd48f.zip
-style fixes
-rw-r--r--src/curl/curl_reschedule.c40
-rw-r--r--src/include/gnunet_configuration_lib.h129
-rw-r--r--src/util/configuration.c2
3 files changed, 77 insertions, 94 deletions
diff --git a/src/curl/curl_reschedule.c b/src/curl/curl_reschedule.c
index a1fe55aa5..0c19bd171 100644
--- a/src/curl/curl_reschedule.c
+++ b/src/curl/curl_reschedule.c
@@ -59,12 +59,6 @@ struct GNUNET_CURL_RescheduleContext
59}; 59};
60 60
61 61
62/**
63 * Initialize reschedule context; with custom response parser
64 *
65 * @param ctx context to manage
66 * @return closure for #GNUNET_CURL_gnunet_scheduler_reschedule().
67 */
68struct GNUNET_CURL_RescheduleContext * 62struct GNUNET_CURL_RescheduleContext *
69GNUNET_CURL_gnunet_rc_create_with_parser (struct GNUNET_CURL_Context *ctx, 63GNUNET_CURL_gnunet_rc_create_with_parser (struct GNUNET_CURL_Context *ctx,
70 GNUNET_CURL_RawParser rp, 64 GNUNET_CURL_RawParser rp,
@@ -93,12 +87,6 @@ clean_result (void *response)
93} 87}
94 88
95 89
96/**
97 * Initialize reschedule context.
98 *
99 * @param ctx context to manage
100 * @return closure for #GNUNET_CURL_gnunet_scheduler_reschedule().
101 */
102struct GNUNET_CURL_RescheduleContext * 90struct GNUNET_CURL_RescheduleContext *
103GNUNET_CURL_gnunet_rc_create (struct GNUNET_CURL_Context *ctx) 91GNUNET_CURL_gnunet_rc_create (struct GNUNET_CURL_Context *ctx)
104{ 92{
@@ -112,11 +100,6 @@ GNUNET_CURL_gnunet_rc_create (struct GNUNET_CURL_Context *ctx)
112} 100}
113 101
114 102
115/**
116 * Destroy reschedule context.
117 *
118 * @param rc context to destroy
119 */
120void 103void
121GNUNET_CURL_gnunet_rc_destroy (struct GNUNET_CURL_RescheduleContext *rc) 104GNUNET_CURL_gnunet_rc_destroy (struct GNUNET_CURL_RescheduleContext *rc)
122{ 105{
@@ -159,13 +142,18 @@ context_task (void *cls)
159 &timeout); 142 &timeout);
160 if (timeout >= 0) 143 if (timeout >= 0)
161 delay = 144 delay =
162 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, timeout); 145 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
146 timeout);
163 else 147 else
164 delay = GNUNET_TIME_UNIT_FOREVER_REL; 148 delay = GNUNET_TIME_UNIT_FOREVER_REL;
165 rs = GNUNET_NETWORK_fdset_create (); 149 rs = GNUNET_NETWORK_fdset_create ();
166 GNUNET_NETWORK_fdset_copy_native (rs, &read_fd_set, max_fd + 1); 150 GNUNET_NETWORK_fdset_copy_native (rs,
151 &read_fd_set,
152 max_fd + 1);
167 ws = GNUNET_NETWORK_fdset_create (); 153 ws = GNUNET_NETWORK_fdset_create ();
168 GNUNET_NETWORK_fdset_copy_native (ws, &write_fd_set, max_fd + 1); 154 GNUNET_NETWORK_fdset_copy_native (ws,
155 &write_fd_set,
156 max_fd + 1);
169 if (NULL == rc->task) 157 if (NULL == rc->task)
170 rc->task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 158 rc->task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
171 delay, 159 delay,
@@ -178,15 +166,6 @@ context_task (void *cls)
178} 166}
179 167
180 168
181/**
182 * Implementation of the #GNUNET_CURL_RescheduleCallback for GNUnet's
183 * scheduler. Will run the CURL context using GNUnet's scheduler.
184 * Note that you MUST immediately destroy the reschedule context after
185 * calling #GNUNET_CURL_fini().
186 *
187 * @param cls must point to a `struct GNUNET_CURL_RescheduleContext *`
188 * (pointer to a pointer!)
189 */
190void 169void
191GNUNET_CURL_gnunet_scheduler_reschedule (void *cls) 170GNUNET_CURL_gnunet_scheduler_reschedule (void *cls)
192{ 171{
@@ -194,7 +173,8 @@ GNUNET_CURL_gnunet_scheduler_reschedule (void *cls)
194 173
195 if (NULL != rc->task) 174 if (NULL != rc->task)
196 GNUNET_SCHEDULER_cancel (rc->task); 175 GNUNET_SCHEDULER_cancel (rc->task);
197 rc->task = GNUNET_SCHEDULER_add_now (&context_task, rc); 176 rc->task = GNUNET_SCHEDULER_add_now (&context_task,
177 rc);
198} 178}
199 179
200 180
diff --git a/src/include/gnunet_configuration_lib.h b/src/include/gnunet_configuration_lib.h
index 3384c6d45..bc862f54f 100644
--- a/src/include/gnunet_configuration_lib.h
+++ b/src/include/gnunet_configuration_lib.h
@@ -160,8 +160,8 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
160 * present. This memory should be freed by the caller 160 * present. This memory should be freed by the caller
161 */ 161 */
162char * 162char *
163GNUNET_CONFIGURATION_serialize_diagnostics (const struct 163GNUNET_CONFIGURATION_serialize_diagnostics (
164 GNUNET_CONFIGURATION_Handle *cfg); 164 const struct GNUNET_CONFIGURATION_Handle *cfg);
165 165
166/** 166/**
167 * De-serializes configuration 167 * De-serializes configuration
@@ -266,8 +266,8 @@ GNUNET_CONFIGURATION_parse_and_run (const char *filename,
266 * @param cfg configuration handle 266 * @param cfg configuration handle
267 */ 267 */
268void 268void
269GNUNET_CONFIGURATION_enable_diagnostics (struct 269GNUNET_CONFIGURATION_enable_diagnostics (
270 GNUNET_CONFIGURATION_Handle *cfg); 270 struct GNUNET_CONFIGURATION_Handle *cfg);
271 271
272 272
273/** 273/**
@@ -292,8 +292,8 @@ typedef void
292 * @param section name of the section 292 * @param section name of the section
293 */ 293 */
294typedef void 294typedef void
295(*GNUNET_CONFIGURATION_Section_Iterator) (void *cls, 295(*GNUNET_CONFIGURATION_SectionIterator) (void *cls,
296 const char *section); 296 const char *section);
297 297
298 298
299/** 299/**
@@ -319,7 +319,7 @@ GNUNET_CONFIGURATION_iterate (const struct GNUNET_CONFIGURATION_Handle *cfg,
319void 319void
320GNUNET_CONFIGURATION_iterate_sections ( 320GNUNET_CONFIGURATION_iterate_sections (
321 const struct GNUNET_CONFIGURATION_Handle *cfg, 321 const struct GNUNET_CONFIGURATION_Handle *cfg,
322 GNUNET_CONFIGURATION_Section_Iterator iter, 322 GNUNET_CONFIGURATION_SectionIterator iter,
323 void *iter_cls); 323 void *iter_cls);
324 324
325 325
@@ -344,11 +344,11 @@ GNUNET_CONFIGURATION_remove_section (struct GNUNET_CONFIGURATION_Handle *cfg,
344 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 344 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
345 */ 345 */
346enum GNUNET_GenericReturnValue 346enum GNUNET_GenericReturnValue
347GNUNET_CONFIGURATION_get_value_number (const struct 347GNUNET_CONFIGURATION_get_value_number (
348 GNUNET_CONFIGURATION_Handle *cfg, 348 const struct GNUNET_CONFIGURATION_Handle *cfg,
349 const char *section, 349 const char *section,
350 const char *option, 350 const char *option,
351 unsigned long long *number); 351 unsigned long long *number);
352 352
353 353
354/** 354/**
@@ -361,11 +361,11 @@ GNUNET_CONFIGURATION_get_value_number (const struct
361 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 361 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
362 */ 362 */
363enum GNUNET_GenericReturnValue 363enum GNUNET_GenericReturnValue
364GNUNET_CONFIGURATION_get_value_float (const struct 364GNUNET_CONFIGURATION_get_value_float (
365 GNUNET_CONFIGURATION_Handle *cfg, 365 const struct GNUNET_CONFIGURATION_Handle *cfg,
366 const char *section, 366 const char *section,
367 const char *option, 367 const char *option,
368 float *number); 368 float *number);
369 369
370 370
371/** 371/**
@@ -378,11 +378,11 @@ GNUNET_CONFIGURATION_get_value_float (const struct
378 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 378 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
379 */ 379 */
380enum GNUNET_GenericReturnValue 380enum GNUNET_GenericReturnValue
381GNUNET_CONFIGURATION_get_value_time (const struct 381GNUNET_CONFIGURATION_get_value_time (
382 GNUNET_CONFIGURATION_Handle *cfg, 382 const struct GNUNET_CONFIGURATION_Handle *cfg,
383 const char *section, 383 const char *section,
384 const char *option, 384 const char *option,
385 struct GNUNET_TIME_Relative *time); 385 struct GNUNET_TIME_Relative *time);
386 386
387 387
388/** 388/**
@@ -395,11 +395,11 @@ GNUNET_CONFIGURATION_get_value_time (const struct
395 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 395 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
396 */ 396 */
397enum GNUNET_GenericReturnValue 397enum GNUNET_GenericReturnValue
398GNUNET_CONFIGURATION_get_value_size (const struct 398GNUNET_CONFIGURATION_get_value_size (
399 GNUNET_CONFIGURATION_Handle *cfg, 399 const struct GNUNET_CONFIGURATION_Handle *cfg,
400 const char *section, 400 const char *section,
401 const char *option, 401 const char *option,
402 unsigned long long *size); 402 unsigned long long *size);
403 403
404 404
405/** 405/**
@@ -446,11 +446,11 @@ GNUNET_CONFIGURATION_get_value_string (
446 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 446 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
447 */ 447 */
448enum GNUNET_GenericReturnValue 448enum GNUNET_GenericReturnValue
449GNUNET_CONFIGURATION_get_value_filename (const struct 449GNUNET_CONFIGURATION_get_value_filename (
450 GNUNET_CONFIGURATION_Handle *cfg, 450 const struct GNUNET_CONFIGURATION_Handle *cfg,
451 const char *section, 451 const char *section,
452 const char *option, 452 const char *option,
453 char **value); 453 char **value);
454 454
455 455
456/** 456/**
@@ -464,12 +464,13 @@ GNUNET_CONFIGURATION_get_value_filename (const struct
464 * @return number of filenames iterated over, -1 on error 464 * @return number of filenames iterated over, -1 on error
465 */ 465 */
466int 466int
467GNUNET_CONFIGURATION_iterate_value_filenames (const struct 467GNUNET_CONFIGURATION_iterate_value_filenames (
468 GNUNET_CONFIGURATION_Handle *cfg, 468 const struct GNUNET_CONFIGURATION_Handle *cfg,
469 const char *section, 469 const char *section,
470 const char *option, 470 const char *option,
471 GNUNET_FileNameCallback cb, 471 GNUNET_FileNameCallback cb,
472 void *cb_cls); 472 void *cb_cls);
473
473 474
474/** 475/**
475 * Iterate over values of a section in the configuration. 476 * Iterate over values of a section in the configuration.
@@ -480,11 +481,12 @@ GNUNET_CONFIGURATION_iterate_value_filenames (const struct
480 * @param iter_cls closure for @a iter 481 * @param iter_cls closure for @a iter
481 */ 482 */
482void 483void
483GNUNET_CONFIGURATION_iterate_section_values (const struct 484GNUNET_CONFIGURATION_iterate_section_values (
484 GNUNET_CONFIGURATION_Handle *cfg, 485 const struct GNUNET_CONFIGURATION_Handle *cfg,
485 const char *section, 486 const char *section,
486 GNUNET_CONFIGURATION_Iterator iter, 487 GNUNET_CONFIGURATION_Iterator iter,
487 void *iter_cls); 488 void *iter_cls);
489
488 490
489/** 491/**
490 * Get a configuration value that should be in a set of 492 * Get a configuration value that should be in a set of
@@ -499,12 +501,13 @@ GNUNET_CONFIGURATION_iterate_section_values (const struct
499 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 501 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
500 */ 502 */
501enum GNUNET_GenericReturnValue 503enum GNUNET_GenericReturnValue
502GNUNET_CONFIGURATION_get_value_choice (const struct 504GNUNET_CONFIGURATION_get_value_choice (
503 GNUNET_CONFIGURATION_Handle *cfg, 505 const struct GNUNET_CONFIGURATION_Handle *cfg,
504 const char *section, 506 const char *section,
505 const char *option, 507 const char *option,
506 const char *const *choices, 508 const char *const *choices,
507 const char **value); 509 const char **value);
510
508 511
509/** 512/**
510 * Get a configuration value that should be in a set of 513 * Get a configuration value that should be in a set of
@@ -516,10 +519,10 @@ GNUNET_CONFIGURATION_get_value_choice (const struct
516 * @return #GNUNET_YES, #GNUNET_NO or if option has no valid value, #GNUNET_SYSERR 519 * @return #GNUNET_YES, #GNUNET_NO or if option has no valid value, #GNUNET_SYSERR
517 */ 520 */
518enum GNUNET_GenericReturnValue 521enum GNUNET_GenericReturnValue
519GNUNET_CONFIGURATION_get_value_yesno (const struct 522GNUNET_CONFIGURATION_get_value_yesno (
520 GNUNET_CONFIGURATION_Handle *cfg, 523 const struct GNUNET_CONFIGURATION_Handle *cfg,
521 const char *section, 524 const char *section,
522 const char *option); 525 const char *option);
523 526
524 527
525/** 528/**
@@ -606,11 +609,11 @@ GNUNET_CONFIGURATION_set_value_string (struct GNUNET_CONFIGURATION_Handle *cfg,
606 * #GNUNET_SYSERR if the filename is not in the list 609 * #GNUNET_SYSERR if the filename is not in the list
607 */ 610 */
608enum GNUNET_GenericReturnValue 611enum GNUNET_GenericReturnValue
609GNUNET_CONFIGURATION_remove_value_filename (struct 612GNUNET_CONFIGURATION_remove_value_filename (
610 GNUNET_CONFIGURATION_Handle *cfg, 613 struct GNUNET_CONFIGURATION_Handle *cfg,
611 const char *section, 614 const char *section,
612 const char *option, 615 const char *option,
613 const char *value); 616 const char *value);
614 617
615 618
616/** 619/**
@@ -625,11 +628,11 @@ GNUNET_CONFIGURATION_remove_value_filename (struct
625 * #GNUNET_SYSERR if the filename already in the list 628 * #GNUNET_SYSERR if the filename already in the list
626 */ 629 */
627enum GNUNET_GenericReturnValue 630enum GNUNET_GenericReturnValue
628GNUNET_CONFIGURATION_append_value_filename (struct 631GNUNET_CONFIGURATION_append_value_filename (
629 GNUNET_CONFIGURATION_Handle *cfg, 632 struct GNUNET_CONFIGURATION_Handle *cfg,
630 const char *section, 633 const char *section,
631 const char *option, 634 const char *option,
632 const char *value); 635 const char *value);
633 636
634 637
635/** 638/**
diff --git a/src/util/configuration.c b/src/util/configuration.c
index d9d6721cc..27e6cf612 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -1433,7 +1433,7 @@ GNUNET_CONFIGURATION_iterate_section_values (
1433void 1433void
1434GNUNET_CONFIGURATION_iterate_sections ( 1434GNUNET_CONFIGURATION_iterate_sections (
1435 const struct GNUNET_CONFIGURATION_Handle *cfg, 1435 const struct GNUNET_CONFIGURATION_Handle *cfg,
1436 GNUNET_CONFIGURATION_Section_Iterator iter, 1436 GNUNET_CONFIGURATION_SectionIterator iter,
1437 void *iter_cls) 1437 void *iter_cls)
1438{ 1438{
1439 struct ConfigSection *spos; 1439 struct ConfigSection *spos;