[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 68/70: - DID lib; simplify closure
From: |
gnunet |
Subject: |
[gnunet] 68/70: - DID lib; simplify closure |
Date: |
Wed, 31 Aug 2022 18:01:02 +0200 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 41ed66d82fe38b460f4a04541d5a28848b0db8f2
Author: Tristan Schwieren <tristan.schwieren@tum.de>
AuthorDate: Fri Jul 8 14:16:58 2022 +0200
- DID lib; simplify closure
---
src/reclaim/did_core.c | 31 +++++++++++--------------------
1 file changed, 11 insertions(+), 20 deletions(-)
diff --git a/src/reclaim/did_core.c b/src/reclaim/did_core.c
index 69331c6ea..949ed6a69 100644
--- a/src/reclaim/did_core.c
+++ b/src/reclaim/did_core.c
@@ -147,8 +147,7 @@ struct DID_create_namestore_lookup_closure
const char *did_document;
struct GNUNET_TIME_Relative expire_time;
struct GNUNET_NAMESTORE_Handle *namestore_handle;
- DID_action_callback *cont;
- void *cls;
+ struct DID_action_return *ret;
};
static void
@@ -171,16 +170,15 @@ DID_create_namestore_lookup_cb (void *cls,
struct GNUNET_NAMESTORE_Handle *namestore_handle
= ((struct DID_create_namestore_lookup_closure *) cls)->namestore_handle;
- DID_action_callback *cont
- = ((struct DID_create_namestore_lookup_closure *) cls)->cont;
+ struct DID_action_return *cls_record_store_cb
+ = ((struct DID_create_namestore_lookup_closure *) cls)->ret;
- void *cls1
- = ((struct DID_create_namestore_lookup_closure *) cls)->cls;
+ free (cls);
if (rd_count > 0)
{
printf ("Ego already has a DID Document. Abort.\n");
- cont (GNUNET_NO, cls1);
+ cls_record_store_cb->cb (GNUNET_NO, cls_record_store_cb->cls);
}
else {
// Get public key
@@ -200,12 +198,6 @@ DID_create_namestore_lookup_cb (void *cls,
record_data.record_type = GNUNET_GNSRECORD_typename_to_number ("TXT"),
record_data.flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
- // Create closure for record store callback
- struct DID_action_return *cls_record_store_cb
- = malloc (sizeof(struct DID_action_return));
- cls_record_store_cb->cb = cont;
- cls_record_store_cb->cls = cls1;
-
// Store record
GNUNET_NAMESTORE_records_store (namestore_handle,
zone,
@@ -214,10 +206,7 @@ DID_create_namestore_lookup_cb (void *cls,
&record_data,
&DID_create_did_store_cb,
(void *) cls_record_store_cb);
-
}
-
- free (cls);
}
/**
@@ -226,8 +215,6 @@ DID_create_namestore_lookup_cb (void *cls,
* @param ego ego for which the DID should be created.
* @param did_document did_document that should be saved in namestore.
* If did_document==NULL -> Default DID document is created.
- * @param cfg_handle pointer to configuration handle
- * @param identity_hanlde pointer to identity handle. Can be NULL if ego!=NULL
* @param namestore_handle
* @param cont callback function
* @param cls closure
@@ -255,13 +242,17 @@ DID_create (const struct GNUNET_IDENTITY_Ego *ego,
return GNUNET_NO;
}
+ struct DID_action_return *ret
+ = malloc (sizeof(struct DID_action_return));
+ ret->cb = cont;
+ ret->cls = cls;
+
struct DID_create_namestore_lookup_closure *cls_name_store_lookup_cb
= malloc (sizeof(struct DID_create_namestore_lookup_closure));
cls_name_store_lookup_cb->did_document = did_document;
cls_name_store_lookup_cb->expire_time = (*expire_time);
cls_name_store_lookup_cb->namestore_handle = namestore_handle;
- cls_name_store_lookup_cb->cont = cont;
- cls_name_store_lookup_cb->cls = cls;
+ cls_name_store_lookup_cb->ret = ret;
// Check if ego already has a DID Document
GNUNET_NAMESTORE_records_lookup (namestore_handle,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] 47/70: -move to reclaim, (continued)
- [gnunet] 47/70: -move to reclaim, gnunet, 2022/08/31
- [gnunet] 44/70: -add comments, gnunet, 2022/08/31
- [gnunet] 43/70: -mergefix, gnunet, 2022/08/31
- [gnunet] 36/70: -did not working remove abstraction, gnunet, 2022/08/31
- [gnunet] 45/70: fix bugs, gnunet, 2022/08/31
- [gnunet] 66/70: - DID lib; renamed vars and moved a free, gnunet, 2022/08/31
- [gnunet] 63/70: - remove static variable from did_core, gnunet, 2022/08/31
- [gnunet] 55/70: - finished DID helper with tests, gnunet, 2022/08/31
- [gnunet] 60/70: - started with DID lib create func, gnunet, 2022/08/31
- [gnunet] 54/70: - default did document test without multibase, gnunet, 2022/08/31
- [gnunet] 68/70: - DID lib; simplify closure,
gnunet <=
- [gnunet] 30/70: -DID refactor, uncrustify, not working didd create, gnunet, 2022/08/31
- [gnunet] 31/70: - did not working create, gnunet, 2022/08/31
- [gnunet] 46/70: -code review, gnunet, 2022/08/31
- [gnunet] 53/70: - more tests, gnunet, 2022/08/31
- [gnunet] 61/70: - non working DID lib create func, gnunet, 2022/08/31
- [gnunet] 57/70: - changed did_core header, gnunet, 2022/08/31
- [gnunet] 59/70: - DID resolve using DID lib, gnunet, 2022/08/31
- [gnunet] 67/70: - DID lib; formatting, gnunet, 2022/08/31
- [gnunet] 51/70: - trying to make did_helper a lib, gnunet, 2022/08/31
- [gnunet] 64/70: - didlib; use expire value, gnunet, 2022/08/31