[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 02/02: improve performance of identity_api_lookup.
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 02/02: improve performance of identity_api_lookup.c logic to not be O(n) |
Date: |
Sat, 01 Jun 2019 00:58:48 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit 9f03df3be26e78853cc0d2288d2260b9032126cb
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Jun 1 00:58:06 2019 +0200
improve performance of identity_api_lookup.c logic to not be O(n)
---
src/identity/identity_api.c | 2 ++
src/identity/test_identity_defaults.c | 26 +++++++++++++++++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index fa7c8b023..c463da641 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -596,6 +596,7 @@ GNUNET_IDENTITY_get (struct GNUNET_IDENTITY_Handle *h,
if (NULL == h->mq)
return NULL;
+ GNUNET_assert (NULL != h->cb);
slen = strlen (service_name) + 1;
if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (struct GetDefaultMessage))
{
@@ -641,6 +642,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
if (NULL == h->mq)
return NULL;
+ GNUNET_assert (NULL != h->cb);
slen = strlen (service_name) + 1;
if (slen >= GNUNET_MAX_MESSAGE_SIZE - sizeof (struct SetDefaultMessage))
{
diff --git a/src/identity/test_identity_defaults.c
b/src/identity/test_identity_defaults.c
index ecda31c4c..71e70e7ba 100644
--- a/src/identity/test_identity_defaults.c
+++ b/src/identity/test_identity_defaults.c
@@ -148,6 +148,30 @@ get_cb (void *cls,
}
+/**
+ * Called with events about egos.
+ *
+ * @param cls NULL
+ * @param ego ego handle
+ * @param ego_ctx context for application to store data for this ego
+ * (during the lifetime of this process, initially NULL)
+ * @param identifier identifier assigned by the user for this ego,
+ * NULL if the user just deleted the ego and it
+ * must thus no longer be used
+ */
+static void
+dummy_cb (void *cls,
+ struct GNUNET_IDENTITY_Ego *ego,
+ void **ctx,
+ const char *identifier)
+{
+ (void) cls;
+ (void) ego;
+ (void) ctx;
+ (void) identifier;
+}
+
+
/**
* Main function of the test, run from scheduler.
*
@@ -162,7 +186,7 @@ run_get (void *cls,
{
endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &endbadly, NULL);
GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL);
- h = GNUNET_IDENTITY_connect (cfg, NULL, NULL);
+ h = GNUNET_IDENTITY_connect (cfg, &dummy_cb, NULL);
CHECK (NULL != h);
op = GNUNET_IDENTITY_get (h, "test-service", &get_cb, NULL);
}
--
To stop receiving notification emails like this one, please contact
address@hidden