gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r9214 - in gnunet/src: include util


From: gnunet
Subject: [GNUnet-SVN] r9214 - in gnunet/src: include util
Date: Tue, 20 Oct 2009 01:23:56 -0600

Author: grothoff
Date: 2009-10-20 01:23:56 -0600 (Tue, 20 Oct 2009)
New Revision: 9214

Modified:
   gnunet/src/include/gnunet_container_lib.h
   gnunet/src/util/container_multihashmap.c
   gnunet/src/util/test_container_multihashmap.c
Log:
remove get_random from API

Modified: gnunet/src/include/gnunet_container_lib.h
===================================================================
--- gnunet/src/include/gnunet_container_lib.h   2009-10-20 07:21:37 UTC (rev 
9213)
+++ gnunet/src/include/gnunet_container_lib.h   2009-10-20 07:23:56 UTC (rev 
9214)
@@ -633,22 +633,6 @@
                                                 it, void *it_cls);
 
 
-/**
- * Returns the stored value of a random non-null entry in the hash
- * table.  Returns only the first value, does not go inside bucket
- * linked list (yet).  Runs with a worst case time of N, so it's not
- * efficient in any way shape or form!!!!.
- *
- * @param map the map
- * @return value associated with a random key
- */
-void *GNUNET_CONTAINER_multihashmap_get_random (const struct
-                                                GNUNET_CONTAINER_MultiHashMap
-                                                *map);
-
-
-
-
 /* ******************** doubly-linked list *************** */
 
 /**

Modified: gnunet/src/util/container_multihashmap.c
===================================================================
--- gnunet/src/util/container_multihashmap.c    2009-10-20 07:21:37 UTC (rev 
9213)
+++ gnunet/src/util/container_multihashmap.c    2009-10-20 07:23:56 UTC (rev 
9214)
@@ -451,34 +451,4 @@
 }
 
 
-/**
- * Returns the stored value of a random non-null entry in the hash
- * table.  Returns only the first value, does not go inside bucket
- * linked list (yet).  Runs with a worst case time of N, so it's not
- * efficient in any way shape or form!!!!.
- *
- * @param map the map
- * @return value associated with a random key
- */
-void *
-GNUNET_CONTAINER_multihashmap_get_random (const struct
-                                          GNUNET_CONTAINER_MultiHashMap *map)
-{
-  unsigned int rand;
-  struct MapEntry *e;
-
-  if (map->size == 0)
-    return NULL;
-  while (1)
-    {
-      rand =
-        GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
-                                  map->map_length);
-      if (NULL != (e = map->map[rand]))
-       return e->value;
-    }
-  return e->value;
-}
-
-
 /* end of container_multihashmap.c */

Modified: gnunet/src/util/test_container_multihashmap.c
===================================================================
--- gnunet/src/util/test_container_multihashmap.c       2009-10-20 07:21:37 UTC 
(rev 9213)
+++ gnunet/src/util/test_container_multihashmap.c       2009-10-20 07:23:56 UTC 
(rev 9214)
@@ -84,8 +84,6 @@
   CHECK (0 ==
          GNUNET_CONTAINER_multihashmap_get_multiple (m, &k2, NULL, NULL));
   CHECK (2 == GNUNET_CONTAINER_multihashmap_iterate (m, NULL, NULL));
-  r = GNUNET_CONTAINER_multihashmap_get_random (m);
-  CHECK (0 == strcmp (r, "v1") || 0 == strcmp (r, "v2"));
   CHECK (2 == GNUNET_CONTAINER_multihashmap_remove_all (m, &k1));
   for (j = 0; j < 1024; j++)
     CHECK (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (m,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]