From c61072f43108dfc14b109278cdebbb4256a969e9 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 14 Jun 2011 11:42:07 +0000 Subject: [PATCH] fixing 1692 --- src/util/peer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/util/peer.c b/src/util/peer.c index f30c720aa..e013c22e9 100644 --- a/src/util/peer.c +++ b/src/util/peer.c @@ -85,12 +85,14 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid) GNUNET_PEER_Id ret; struct PeerEntry *e; unsigned int i; + long off; if (pid == NULL) return 0; if (NULL == map) map = GNUNET_CONTAINER_multihashmap_create (32); - e = GNUNET_CONTAINER_multihashmap_get (map, &pid->hashPubKey); + off = (long) GNUNET_CONTAINER_multihashmap_get (map, &pid->hashPubKey); + e = (off == 0) ? NULL : &table[off]; if (e != NULL) { GNUNET_assert (e->rc > 0); @@ -119,7 +121,7 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid) GNUNET_break (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (map, &pid->hashPubKey, - &table[ret], + (void *) (long) ret, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); return ret; } @@ -152,7 +154,7 @@ GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id * ids, unsigned int count) GNUNET_break (GNUNET_OK == GNUNET_CONTAINER_multihashmap_remove (map, &table[id].id.hashPubKey, - &table[id])); + (void*) (long) id)); table[id].pid = free_list_start; free_list_start = id; } @@ -180,7 +182,7 @@ GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta) GNUNET_break (GNUNET_OK == GNUNET_CONTAINER_multihashmap_remove (map, &table[id].id.hashPubKey, - &table[id])); + (void*) (long) id)); table[id].pid = free_list_start; free_list_start = id; } -- 2.25.1