summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjospaeth <spaethj@in.tum.de>2020-09-02 21:36:05 +0200
committerjospaeth <spaethj@in.tum.de>2020-09-02 21:36:05 +0200
commit3fd3f3fbc9c2f83b3505d4aafe026817944e73c1 (patch)
treea91a4b93714cd7361b8ec70488809dfd879a1661
parente431696955001e45836ab5d2eeda6e49120049e1 (diff)
minor improvements
add static/const
-rw-r--r--src/escrow/escrow_api.c12
-rw-r--r--src/escrow/escrow_plugin_helper.c2
-rw-r--r--src/escrow/gnunet-escrow.c1
-rw-r--r--src/escrow/plugin_escrow_anastasis.c8
-rw-r--r--src/escrow/plugin_escrow_gns.c16
-rw-r--r--src/escrow/plugin_escrow_plaintext.c18
-rw-r--r--src/include/gnunet_escrow_lib.h4
-rw-r--r--src/include/gnunet_escrow_plugin.h4
8 files changed, 33 insertions, 32 deletions
diff --git a/src/escrow/escrow_api.c b/src/escrow/escrow_api.c
index 4b3f5e68d..5d1701405 100644
--- a/src/escrow/escrow_api.c
+++ b/src/escrow/escrow_api.c
@@ -99,8 +99,8 @@ static struct GNUNET_ESCROW_KeyPluginFunctions *anastasis_api;
*
* @return pointer to the escrow plugin API
*/
-const struct GNUNET_ESCROW_KeyPluginFunctions *
-init_plugin (struct GNUNET_ESCROW_Handle *h,
+static const struct GNUNET_ESCROW_KeyPluginFunctions *
+init_plugin (const struct GNUNET_ESCROW_Handle *h,
enum GNUNET_ESCROW_Key_Escrow_Method method)
{
switch (method)
@@ -228,7 +228,7 @@ GNUNET_ESCROW_fini (struct GNUNET_ESCROW_Handle *h)
}
-void
+static void
handle_start_escrow_result (void *cls)
{
struct ESCROW_Plugin_AnchorContinuationWrapper *w = cls;
@@ -328,7 +328,7 @@ handle_restore_key_result (void *cls)
*/
struct GNUNET_ESCROW_Operation *
GNUNET_ESCROW_get (struct GNUNET_ESCROW_Handle *h,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
enum GNUNET_ESCROW_Key_Escrow_Method method,
GNUNET_ESCROW_EgoContinuation cb,
void *cb_cls)
@@ -351,7 +351,7 @@ GNUNET_ESCROW_get (struct GNUNET_ESCROW_Handle *h,
}
-void
+static void
handle_verify_escrow_result (void *cls)
{
struct ESCROW_Plugin_VerifyContinuationWrapper *w = cls;
@@ -388,7 +388,7 @@ handle_verify_escrow_result (void *cls)
struct GNUNET_ESCROW_Operation *
GNUNET_ESCROW_verify (struct GNUNET_ESCROW_Handle *h,
struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
enum GNUNET_ESCROW_Key_Escrow_Method method,
GNUNET_ESCROW_VerifyContinuation cb,
void *cb_cls)
diff --git a/src/escrow/escrow_plugin_helper.c b/src/escrow/escrow_plugin_helper.c
index 36acae049..3e14edf4f 100644
--- a/src/escrow/escrow_plugin_helper.c
+++ b/src/escrow/escrow_plugin_helper.c
@@ -176,7 +176,7 @@ ESCROW_cleanup_ego_list (struct ESCROW_PluginHandle *ph)
}
-char *
+static char *
string_to_upper (const char *str)
{
char *str_upper;
diff --git a/src/escrow/gnunet-escrow.c b/src/escrow/gnunet-escrow.c
index 36728f949..2f22fa194 100644
--- a/src/escrow/gnunet-escrow.c
+++ b/src/escrow/gnunet-escrow.c
@@ -215,6 +215,7 @@ put_cb (void *cls,
"in order to restore the key later!\n%s\n", anchorString);
}
cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
+ GNUNET_free (anchor);
}
diff --git a/src/escrow/plugin_escrow_anastasis.c b/src/escrow/plugin_escrow_anastasis.c
index 512918742..5353b435a 100644
--- a/src/escrow/plugin_escrow_anastasis.c
+++ b/src/escrow/plugin_escrow_anastasis.c
@@ -39,7 +39,7 @@ static struct GNUNET_IDENTITY_Handle *identity_handle;
/**
* Handle for the plugin instance
*/
-struct ESCROW_PluginHandle ph;
+static struct ESCROW_PluginHandle ph;
/**
@@ -88,7 +88,7 @@ start_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
struct ESCROW_PluginOperationWrapper *
verify_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
GNUNET_SCHEDULER_TaskCallback cb,
uint32_t op_id)
{
@@ -118,7 +118,7 @@ verify_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
*/
struct ESCROW_PluginOperationWrapper *
restore_anastasis_key_escrow (struct GNUNET_ESCROW_Handle *h,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
GNUNET_SCHEDULER_TaskCallback cb,
uint32_t op_id)
{
@@ -168,7 +168,7 @@ cancel_anastasis_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap
/**
* IdentityInitContinuation for the Anastasis plugin
*/
-void
+static void
anastasis_cont_init ()
{
return;
diff --git a/src/escrow/plugin_escrow_gns.c b/src/escrow/plugin_escrow_gns.c
index bd96d2315..cf12602ca 100644
--- a/src/escrow/plugin_escrow_gns.c
+++ b/src/escrow/plugin_escrow_gns.c
@@ -355,14 +355,14 @@ static struct GNUNET_IDENTITY_Handle *identity_handle;
/**
* Handle for the plugin instance
*/
-struct ESCROW_PluginHandle ph;
+static struct ESCROW_PluginHandle ph;
/**
* Clean up a plugin operation, i.e. remove it from the list and
* free the respective memory
*/
-void
+static void
cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap)
{
struct ESCROW_GnsPluginOperation *p_op;
@@ -459,7 +459,7 @@ cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap)
}
-void
+static void
start_cont (void *cls)
{
struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls;
@@ -472,7 +472,7 @@ start_cont (void *cls)
}
-void
+static void
verify_cont (void *cls)
{
struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls;
@@ -1109,7 +1109,7 @@ start_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
static uint8_t
-count_keyshares (sss_Keyshare *keyshares, uint8_t n)
+count_keyshares (const sss_Keyshare *keyshares, uint8_t n)
{
uint8_t i, c;
sss_Keyshare null_ks;
@@ -1313,7 +1313,7 @@ get_user_secret_from_anchor (const struct GNUNET_ESCROW_Anchor *anchor)
static void
restore_private_key (struct ESCROW_PluginOperationWrapper *plugin_op_wrap,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
PkContinuation cont,
void *cont_cls)
{
@@ -1423,7 +1423,7 @@ verify_restored_pk (void *cls,
struct ESCROW_PluginOperationWrapper *
verify_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
GNUNET_SCHEDULER_TaskCallback cb,
uint32_t op_id)
{
@@ -1577,7 +1577,7 @@ restore_ego_from_pk (void *cls,
*/
struct ESCROW_PluginOperationWrapper *
restore_gns_key_escrow (struct GNUNET_ESCROW_Handle *h,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
GNUNET_SCHEDULER_TaskCallback cb,
uint32_t op_id)
{
diff --git a/src/escrow/plugin_escrow_plaintext.c b/src/escrow/plugin_escrow_plaintext.c
index 9eb1fb120..623504a6b 100644
--- a/src/escrow/plugin_escrow_plaintext.c
+++ b/src/escrow/plugin_escrow_plaintext.c
@@ -86,14 +86,14 @@ static struct GNUNET_IDENTITY_Handle *identity_handle;
/**
* Handle for the plugin instance
*/
-struct ESCROW_PluginHandle ph;
+static struct ESCROW_PluginHandle ph;
/**
* Clean up a plugin operation, i.e. remove it from the list and
* free the respective memory
*/
-void
+static void
cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap)
{
struct ESCROW_PlaintextPluginOperation *p_op;
@@ -114,7 +114,7 @@ cleanup_plugin_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap)
}
-void
+static void
start_cont (void *cls)
{
struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls;
@@ -196,7 +196,7 @@ start_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
}
-void
+static void
verify_cont (void *cls)
{
struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls;
@@ -223,7 +223,7 @@ verify_cont (void *cls)
struct ESCROW_PluginOperationWrapper *
verify_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
ESCROW_Plugin_Continuation cb,
uint32_t op_id)
{
@@ -277,7 +277,7 @@ verify_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
}
-void
+static void
ego_created (const struct GNUNET_IDENTITY_Ego *ego)
{
struct ESCROW_PluginOperationWrapper *curr;
@@ -348,7 +348,7 @@ create_finished (void *cls,
}
-void
+static void
handle_restore_error (void *cls)
{
struct ESCROW_PluginOperationWrapper *plugin_op_wrap = cls;
@@ -373,7 +373,7 @@ handle_restore_error (void *cls)
*/
struct ESCROW_PluginOperationWrapper *
restore_plaintext_key_escrow (struct GNUNET_ESCROW_Handle *h,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
ESCROW_Plugin_Continuation cb,
uint32_t op_id)
{
@@ -478,7 +478,7 @@ cancel_plaintext_operation (struct ESCROW_PluginOperationWrapper *plugin_op_wrap
/**
* IdentityInitContinuation for the plaintext plugin
*/
-void
+static void
plaintext_cont_init ()
{
return;
diff --git a/src/include/gnunet_escrow_lib.h b/src/include/gnunet_escrow_lib.h
index 3d3e39664..e02906934 100644
--- a/src/include/gnunet_escrow_lib.h
+++ b/src/include/gnunet_escrow_lib.h
@@ -320,7 +320,7 @@ GNUNET_ESCROW_put (
struct GNUNET_ESCROW_Operation *
GNUNET_ESCROW_get (
struct GNUNET_ESCROW_Handle *h,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
enum GNUNET_ESCROW_Key_Escrow_Method method,
GNUNET_ESCROW_EgoContinuation cb,
void *cb_cls);
@@ -342,7 +342,7 @@ struct GNUNET_ESCROW_Operation *
GNUNET_ESCROW_verify (
struct GNUNET_ESCROW_Handle *h,
struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
enum GNUNET_ESCROW_Key_Escrow_Method method,
GNUNET_ESCROW_VerifyContinuation cb,
void *cb_cls);
diff --git a/src/include/gnunet_escrow_plugin.h b/src/include/gnunet_escrow_plugin.h
index 3095d3616..bc1ea6f52 100644
--- a/src/include/gnunet_escrow_plugin.h
+++ b/src/include/gnunet_escrow_plugin.h
@@ -77,7 +77,7 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_StartKeyEscrowFunc
typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_VerifyKeyEscrowFunction) (
struct GNUNET_ESCROW_Handle *h,
struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
GNUNET_SCHEDULER_TaskCallback cb,
uint32_t op_id);
@@ -93,7 +93,7 @@ typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_VerifyKeyEscrowFun
*/
typedef struct ESCROW_PluginOperationWrapper *(*GNUNET_ESCROW_RestoreKeyFunction) (
struct GNUNET_ESCROW_Handle *h,
- struct GNUNET_ESCROW_Anchor *anchor,
+ const struct GNUNET_ESCROW_Anchor *anchor,
GNUNET_SCHEDULER_TaskCallback cb,
uint32_t op_id);