From 29e6158507a0758192075ac6ece7ba8e75ddc49a Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 9 Apr 2016 23:14:03 +0000 Subject: small API change: do no longer pass rarely needed GNUNET_SCHEDULER_TaskContext to all scheduler tasks; instead, allow the relatively few tasks that need it to obtain the context via GNUNET_SCHEDULER_get_task_context() --- src/revocation/gnunet-revocation.c | 10 ++++------ src/revocation/gnunet-service-revocation.c | 8 ++------ src/revocation/test_revocation.c | 11 ++++------- 3 files changed, 10 insertions(+), 19 deletions(-) (limited to 'src/revocation') diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index 86e5c017d..f68c18aa4 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c @@ -84,11 +84,9 @@ static unsigned long long matching_bits; * Function run if the user aborts with CTRL-C. * * @param cls closure - * @param tc scheduler context */ static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { if (NULL != el) { @@ -231,15 +229,15 @@ perform_revocation (const struct RevocationData *rd) * Perform the proof-of-work calculation. * * @param cls the `struct RevocationData` - * @param tc scheduler context */ static void -calculate_pow (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +calculate_pow (void *cls) { struct RevocationData *rd = cls; + const struct GNUNET_SCHEDULER_TaskContext *tc; /* store temporary results */ + tc = GNUNET_SCHEDULER_get_task_context (); if ( (0 != (GNUNET_SCHEDULER_REASON_SHUTDOWN & tc->reason)) || (0 == (rd->pow % 128) ) ) { diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 9cf1bb812..e41195d55 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c @@ -521,11 +521,9 @@ add_revocation (void *cls, * run the set operation on the revocation certificates. * * @param cls NULL - * @param tc scheduler context (unused) */ static void -transmit_task_cb (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +transmit_task_cb (void *cls) { struct PeerEntry *peer_entry = cls; @@ -662,11 +660,9 @@ free_entry (void *cls, * Task run during shutdown. * * @param cls unused - * @param tc unused */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { if (NULL != revocation_set) { diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c index e9836cc5a..6d6db1b5c 100644 --- a/src/revocation/test_revocation.c +++ b/src/revocation/test_revocation.c @@ -57,8 +57,7 @@ static int ok; static void -do_shutdown (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_shutdown (void *cls) { unsigned int c; @@ -94,8 +93,7 @@ do_shutdown (void *cls, static void -check_revocation (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +check_revocation (void *cls); static void @@ -128,8 +126,7 @@ revocation_remote_cb (void *cls, static void -check_revocation (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +check_revocation (void *cls) { GNUNET_REVOCATION_query (testpeers[0].cfg, &testpeers[1].pubkey, @@ -146,7 +143,7 @@ revocation_cb (void *cls, { fprintf (stderr, "Revocation successful\n"); - check_revocation (NULL, NULL); + check_revocation (NULL); } } -- cgit v1.2.3