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/identity/gnunet-identity.c | 4 +--- src/identity/gnunet-service-identity.c | 3 +-- src/identity/identity_api.c | 7 ++----- src/identity/plugin_rest_identity.c | 24 +++++++++++------------- src/identity/test_identity.c | 6 ++---- src/identity/test_identity_defaults.c | 6 ++---- 6 files changed, 19 insertions(+), 31 deletions(-) (limited to 'src/identity') diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c index 574586b40..dc9174d21 100644 --- a/src/identity/gnunet-identity.c +++ b/src/identity/gnunet-identity.c @@ -84,11 +84,9 @@ static struct GNUNET_IDENTITY_Operation *delete_op; * Task run on shutdown. * * @param cls NULL - * @param tc unused */ static void -shutdown_task (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +shutdown_task (void *cls) { if (NULL != set_op) { diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c index 8a26fb8c3..d36319a99 100644 --- a/src/identity/gnunet-service-identity.c +++ b/src/identity/gnunet-service-identity.c @@ -134,10 +134,9 @@ get_ego_filename (struct Ego *ego) * 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) { struct Ego *e; diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index 6b7ca5c44..1406ddd41 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c @@ -195,11 +195,9 @@ GNUNET_IDENTITY_ego_get_anonymous () * Try again to connect to the identity service. * * @param cls handle to the identity service. - * @param tc scheduler context */ static void -reconnect (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc); +reconnect (void *cls); /** @@ -533,10 +531,9 @@ transmit_next (struct GNUNET_IDENTITY_Handle *h) * Try again to connect to the identity service. * * @param cls handle to the identity service. - * @param tc scheduler context */ static void -reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +reconnect (void *cls) { struct GNUNET_IDENTITY_Handle *h = cls; struct GNUNET_IDENTITY_Operation *op; diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c index 9ab3a8772..22ade6a0e 100644 --- a/src/identity/plugin_rest_identity.c +++ b/src/identity/plugin_rest_identity.c @@ -107,12 +107,12 @@ struct EgoEntry * DLL */ struct EgoEntry *next; - + /** * DLL */ struct EgoEntry *prev; - + /** * Ego Identifier */ @@ -122,7 +122,7 @@ struct EgoEntry * Public key string */ char *keystring; - + /** * The Ego */ @@ -146,7 +146,7 @@ struct RequestHandle * Handle to the rest connection */ struct RestConnectionDataHandle *conndata_handle; - + /** * The processing state */ @@ -170,7 +170,7 @@ struct RequestHandle /** * ID of a task associated with the resolution process. */ - struct GNUNET_SCHEDULER_Task * timeout_task; + struct GNUNET_SCHEDULER_Task * timeout_task; /** * The plugin result processor @@ -260,11 +260,9 @@ cleanup_handle (struct RequestHandle *handle) * Task run on shutdown. Cleans up everything. * * @param cls unused - * @param tc scheduler context */ static void -do_error (void *cls, - const struct GNUNET_SCHEDULER_TaskContext *tc) +do_error (void *cls) { struct RequestHandle *handle = cls; struct MHD_Response *resp; @@ -528,7 +526,7 @@ ego_create_cont (struct RestConnectionDataHandle *con, egoname_json = GNUNET_REST_jsonapi_resource_read_attr (json_res, GNUNET_REST_JSONAPI_IDENTITY_NAME); if (!json_is_string (egoname_json)) { - GNUNET_REST_jsonapi_object_delete (json_obj); + GNUNET_REST_jsonapi_object_delete (json_obj); handle->emsg = GNUNET_strdup ("No name provided"); GNUNET_SCHEDULER_add_now (&do_error, handle); return; @@ -563,7 +561,7 @@ ego_create_cont (struct RestConnectionDataHandle *con, * @param url the url that is requested * @param cls the RequestHandle */ -static void +static void ego_edit_cont (struct RestConnectionDataHandle *con, const char *url, void *cls) @@ -633,7 +631,7 @@ ego_edit_cont (struct RestConnectionDataHandle *con, GNUNET_SCHEDULER_add_now (&do_error, handle); return; } - json_res = GNUNET_REST_jsonapi_object_get_resource (json_obj, 0); + json_res = GNUNET_REST_jsonapi_object_get_resource (json_obj, 0); if (GNUNET_NO == GNUNET_REST_jsonapi_resource_check_type (json_res, GNUNET_REST_JSONAPI_IDENTITY_EGO)) { @@ -692,7 +690,7 @@ ego_edit_cont (struct RestConnectionDataHandle *con, GNUNET_SCHEDULER_add_now (&do_error, handle); } -void +void ego_delete_cont (struct RestConnectionDataHandle *con_handle, const char* url, void *cls) @@ -836,7 +834,7 @@ list_ego (void *cls, if (ID_REST_STATE_INIT == handle->state) { ego_entry = GNUNET_new (struct EgoEntry); GNUNET_IDENTITY_ego_get_public_key (ego, &pk); - ego_entry->keystring = + ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); ego_entry->ego = ego; GNUNET_asprintf (&ego_entry->identifier, "%s", identifier); diff --git a/src/identity/test_identity.c b/src/identity/test_identity.c index 12d182c65..6eaa86e91 100644 --- a/src/identity/test_identity.c +++ b/src/identity/test_identity.c @@ -77,10 +77,9 @@ cleanup () * Termiante the testcase (failure). * * @param cls NULL - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { cleanup (); res = 1; @@ -91,10 +90,9 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Termiante the testcase (success). * * @param cls NULL - * @param tc scheduler context */ static void -end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_normally (void *cls) { cleanup (); res = 0; diff --git a/src/identity/test_identity_defaults.c b/src/identity/test_identity_defaults.c index 961066627..207db321f 100644 --- a/src/identity/test_identity_defaults.c +++ b/src/identity/test_identity_defaults.c @@ -77,10 +77,9 @@ cleanup () * Termiante the testcase (failure). * * @param cls NULL - * @param tc scheduler context */ static void -endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +endbadly (void *cls) { cleanup (); res = 1; @@ -91,10 +90,9 @@ endbadly (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * Termiante the testcase (success). * * @param cls NULL - * @param tc scheduler context */ static void -end_normally (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +end_normally (void *cls) { cleanup (); res = 0; -- cgit v1.2.3