aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorch3 <ch3@140774ce-b5e7-0310-ab8b-a85725594a96>2015-11-30 23:06:16 +0000
committerch3 <ch3@140774ce-b5e7-0310-ab8b-a85725594a96>2015-11-30 23:06:16 +0000
commit195012507478d2eb409a4a5a53f73a8a31dedfa8 (patch)
tree545d6b9c726617a1ba9075b46935d80d7fc0f4cd
parent8ac94742c5f3dcb10bb6d19ff810fdf65b3176ce (diff)
-fixed _clear() in peers "helper"
Signed-off-by: Julius Bünger <buenger@mytum.de> git-svn-id: https://gnunet.org/svn/gnunet@36702 140774ce-b5e7-0310-ab8b-a85725594a96
-rw-r--r--src/rps/gnunet-service-rps_peers.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/rps/gnunet-service-rps_peers.c b/src/rps/gnunet-service-rps_peers.c
index dabf25582b..ffc616bc75 100644
--- a/src/rps/gnunet-service-rps_peers.c
+++ b/src/rps/gnunet-service-rps_peers.c
@@ -290,13 +290,12 @@ CustomPeerMap_remove_peer_by_index (const struct CustomPeerMap *c_peer_map,
void
CustomPeerMap_clear (const struct CustomPeerMap *c_peer_map)
{
- uint64_t i;
-
- for (i = 0; i < CustomPeerMap_size (c_peer_map); i++)
+ while (0 < CustomPeerMap_size (c_peer_map))
{
GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multihashmap32_contains (c_peer_map->hash_map, i));
- CustomPeerMap_remove_peer_by_index (c_peer_map, i);
+ GNUNET_CONTAINER_multihashmap32_contains (c_peer_map->hash_map,
+ CustomPeerMap_size (c_peer_map) -1));
+ CustomPeerMap_remove_peer_by_index (c_peer_map, CustomPeerMap_size (c_peer_map) -1);
}
GNUNET_assert (0 == CustomPeerMap_size (c_peer_map));
}