/**
* Key for the entry.
*/
- struct GNUNET_PeerIdentity key;
+ struct GNUNET_ShortHashCode key;
};
/**
* Key for the entry.
*/
- const struct GNUNET_PeerIdentity *key;
+ const struct GNUNET_ShortHashCode *key;
};
*/
static unsigned int
idx_of (const struct GNUNET_CONTAINER_MultiShortmap *map,
- const struct GNUNET_PeerIdentity *key)
+ const struct GNUNET_ShortHashCode *key)
{
unsigned int kx;
*/
void *
GNUNET_CONTAINER_multishortmap_get (const struct GNUNET_CONTAINER_MultiShortmap *map,
- const struct GNUNET_PeerIdentity *key)
+ const struct GNUNET_ShortHashCode *key)
{
union MapEntry me;
struct SmallMapEntry *sme;
for (sme = me.sme; NULL != sme; sme = sme->next)
- if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity)))
+ if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode)))
return sme->value;
}
else
struct BigMapEntry *bme;
for (bme = me.bme; NULL != bme; bme = bme->next)
- if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity)))
+ if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode)))
return bme->value;
}
return NULL;
int count;
unsigned int i;
union MapEntry me;
- struct GNUNET_PeerIdentity kc;
+ struct GNUNET_ShortHashCode kc;
count = 0;
GNUNET_assert (NULL != map);
*/
int
GNUNET_CONTAINER_multishortmap_remove (struct GNUNET_CONTAINER_MultiShortmap *map,
- const struct GNUNET_PeerIdentity *key,
+ const struct GNUNET_ShortHashCode *key,
const void *value)
{
union MapEntry me;
p = NULL;
for (sme = me.sme; NULL != sme; sme = sme->next)
{
- if ((0 == memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity))) &&
+ if ((0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode))) &&
(value == sme->value))
{
if (NULL == p)
p = NULL;
for (bme = me.bme; NULL != bme; bme = bme->next)
{
- if ((0 == memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity))) &&
+ if ((0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode))) &&
(value == bme->value))
{
if (NULL == p)
*/
int
GNUNET_CONTAINER_multishortmap_remove_all (struct GNUNET_CONTAINER_MultiShortmap *map,
- const struct GNUNET_PeerIdentity *key)
+ const struct GNUNET_ShortHashCode *key)
{
union MapEntry me;
unsigned int i;
sme = me.sme;
while (NULL != sme)
{
- if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity)))
+ if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode)))
{
if (NULL == p)
map->map[i].sme = sme->next;
bme = me.bme;
while (NULL != bme)
{
- if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity)))
+ if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode)))
{
if (NULL == p)
map->map[i].bme = bme->next;
*/
int
GNUNET_CONTAINER_multishortmap_contains (const struct GNUNET_CONTAINER_MultiShortmap *map,
- const struct GNUNET_PeerIdentity *key)
+ const struct GNUNET_ShortHashCode *key)
{
union MapEntry me;
struct SmallMapEntry *sme;
for (sme = me.sme; NULL != sme; sme = sme->next)
- if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity)))
+ if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode)))
return GNUNET_YES;
}
else
struct BigMapEntry *bme;
for (bme = me.bme; NULL != bme; bme = bme->next)
- if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity)))
+ if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode)))
return GNUNET_YES;
}
return GNUNET_NO;
*/
int
GNUNET_CONTAINER_multishortmap_contains_value (const struct GNUNET_CONTAINER_MultiShortmap *map,
- const struct GNUNET_PeerIdentity *key,
+ const struct GNUNET_ShortHashCode *key,
const void *value)
{
union MapEntry me;
struct SmallMapEntry *sme;
for (sme = me.sme; NULL != sme; sme = sme->next)
- if ( (0 == memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity))) &&
+ if ( (0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode))) &&
(sme->value == value) )
return GNUNET_YES;
}
struct BigMapEntry *bme;
for (bme = me.bme; NULL != bme; bme = bme->next)
- if ( (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity))) &&
+ if ( (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode))) &&
(bme->value == value) )
return GNUNET_YES;
}
*/
int
GNUNET_CONTAINER_multishortmap_put (struct GNUNET_CONTAINER_MultiShortmap *map,
- const struct GNUNET_PeerIdentity *key,
+ const struct GNUNET_ShortHashCode *key,
void *value,
enum GNUNET_CONTAINER_MultiHashMapOption opt)
{
struct SmallMapEntry *sme;
for (sme = me.sme; NULL != sme; sme = sme->next)
- if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity)))
+ if (0 == memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode)))
{
if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)
return GNUNET_SYSERR;
struct BigMapEntry *bme;
for (bme = me.bme; NULL != bme; bme = bme->next)
- if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity)))
+ if (0 == memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode)))
{
if (opt == GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)
return GNUNET_SYSERR;
*/
int
GNUNET_CONTAINER_multishortmap_get_multiple (const struct GNUNET_CONTAINER_MultiShortmap *map,
- const struct GNUNET_PeerIdentity *key,
+ const struct GNUNET_ShortHashCode *key,
GNUNET_CONTAINER_ShortmapIterator it,
void *it_cls)
{
while (NULL != (sme = nxt))
{
nxt = sme->next;
- if (0 != memcmp (key, sme->key, sizeof (struct GNUNET_PeerIdentity)))
+ if (0 != memcmp (key, sme->key, sizeof (struct GNUNET_ShortHashCode)))
continue;
if ((it != NULL) && (GNUNET_OK != it (it_cls, key, sme->value)))
return GNUNET_SYSERR;
while (NULL != (bme = nxt))
{
nxt = bme->next;
- if (0 != memcmp (key, &bme->key, sizeof (struct GNUNET_PeerIdentity)))
+ if (0 != memcmp (key, &bme->key, sizeof (struct GNUNET_ShortHashCode)))
continue;
if ((it != NULL) && (GNUNET_OK != it (it_cls, key, bme->value)))
return GNUNET_SYSERR;
*/
int
GNUNET_CONTAINER_multishortmap_iterator_next (struct GNUNET_CONTAINER_MultiShortmapIterator *iter,
- struct GNUNET_PeerIdentity *key, const void **value)
+ struct GNUNET_ShortHashCode *key,
+ const void **value)
{
/* make sure the map has not been modified */
GNUNET_assert (iter->modification_counter == iter->map->modification_counter);