struct PeerEntry
{
/**
- * the identifier itself
+ * The identifier itself
*/
struct GNUNET_PeerIdentity id;
/**
- * Short version of the identifier;
- * if the RC==0, then index of next
- * free slot in table, otherwise
- * equal to this slot in the table.
+ * Short version of the identifier; if the RC==0, then index of next
+ * free slot in table, otherwise equal to this slot in the table.
*/
GNUNET_PEER_Id pid;
/**
- * Reference counter, 0 if this slot
- * is not used.
+ * Reference counter, 0 if this slot is not used.
*/
unsigned int rc;
};
table[ret].id = *pid;
table[ret].rc = 1;
table[ret].pid = ret;
- GNUNET_CONTAINER_multihashmap_put (map,
- &pid->hashPubKey,
- &table[ret],
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_put (map,
+ &pid->hashPubKey,
+ &table[ret],
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
return ret;
}
for (i = count - 1; i >= 0; i--)
{
id = ids[i];
+ if (id == 0)
+ continue;
GNUNET_assert (id < size);
GNUNET_assert (table[id].rc > 0);
table[id].rc--;
if (table[id].rc == 0)
{
- GNUNET_CONTAINER_multihashmap_remove (map,
- &table[id].id.hashPubKey,
- &table[id]);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_remove (map,
+ &table[id].id.hashPubKey,
+ &table[id]));
table[id].pid = free_list_start;
free_list_start = id;
}
table[id].rc += delta;
if (table[id].rc == 0)
{
- GNUNET_CONTAINER_multihashmap_remove (map,
- &table[id].id.hashPubKey,
- &table[id]);
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_remove (map,
+ &table[id].id.hashPubKey,
+ &table[id]));
table[id].pid = free_list_start;
free_list_start = id;
}