aboutsummaryrefslogtreecommitdiff
path: root/src/util/peer.c
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2011-11-04 14:00:32 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2011-11-04 14:00:32 +0000
commit35ae75e2d0f26ad0e25861f3c4a5c4c005fd1378 (patch)
treed0ab9329fcbefe360d9d14e2ace21a6b3396dfe9 /src/util/peer.c
parent99545d48451fe00589106195cb13c63c5f56b893 (diff)
curly wars / auto-indentation
git-svn-id: https://gnunet.org/svn/gnunet@18000 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src/util/peer.c')
-rw-r--r--src/util/peer.c102
1 files changed, 50 insertions, 52 deletions
diff --git a/src/util/peer.c b/src/util/peer.c
index c88e03c153..2444cb9f8b 100644
--- a/src/util/peer.c
+++ b/src/util/peer.c
@@ -107,7 +107,7 @@ GNUNET_PEER_search (const struct GNUNET_PeerIdentity *pid)
* @return the interned identity.
*/
GNUNET_PEER_Id
-GNUNET_PEER_intern (const struct GNUNET_PeerIdentity * pid)
+GNUNET_PEER_intern (const struct GNUNET_PeerIdentity *pid)
{
GNUNET_PEER_Id ret;
struct PeerEntry *e;
@@ -121,24 +121,24 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity * pid)
off = (long) GNUNET_CONTAINER_multihashmap_get (map, &pid->hashPubKey);
e = (off == 0) ? NULL : &table[off];
if (e != NULL)
- {
- GNUNET_assert (e->rc > 0);
- e->rc++;
- return e->pid;
- }
+ {
+ GNUNET_assert (e->rc > 0);
+ e->rc++;
+ return e->pid;
+ }
ret = free_list_start;
if (ret == size)
- {
- GNUNET_array_grow (table, size, size + 16);
- for (i = ret; i < size; i++)
- table[i].pid = i + 1;
- }
+ {
+ GNUNET_array_grow (table, size, size + 16);
+ for (i = ret; i < size; i++)
+ table[i].pid = i + 1;
+ }
if (ret == 0)
- {
- table[0].pid = 0;
- table[0].rc = 1;
- ret = 1;
- }
+ {
+ table[0].pid = 0;
+ table[0].rc = 1;
+ ret = 1;
+ }
GNUNET_assert (ret < size);
GNUNET_assert (table[ret].rc == 0);
free_list_start = table[ret].pid;
@@ -146,9 +146,9 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity * pid)
table[ret].rc = 1;
table[ret].pid = ret;
GNUNET_break (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_put (map, &pid->hashPubKey,
- (void *) (long) ret,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+ GNUNET_CONTAINER_multihashmap_put (map, &pid->hashPubKey,
+ (void *) (long) ret,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
return ret;
}
@@ -160,7 +160,7 @@ GNUNET_PEER_intern (const struct GNUNET_PeerIdentity * pid)
* @param count size of the ids array
*/
void
-GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id * ids, unsigned int count)
+GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id *ids, unsigned int count)
{
int i;
GNUNET_PEER_Id id;
@@ -168,25 +168,24 @@ GNUNET_PEER_decrement_rcs (const GNUNET_PEER_Id * ids, unsigned int count)
if (count == 0)
return;
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)
{
- 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_break (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_remove (map,
- &table[id].
- id.hashPubKey,
- (void *) (long)
- id));
- table[id].pid = free_list_start;
- free_list_start = id;
- }
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_remove (map,
+ &table[id].
+ id.hashPubKey,
+ (void *) (long) id));
+ table[id].pid = free_list_start;
+ free_list_start = id;
}
+ }
}
@@ -206,16 +205,15 @@ GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta)
GNUNET_assert ((delta >= 0) || (table[id].rc >= -delta));
table[id].rc += delta;
if (table[id].rc == 0)
- {
- GNUNET_break (GNUNET_OK ==
- GNUNET_CONTAINER_multihashmap_remove (map,
- &table[id].
- id.hashPubKey,
- (void *) (long)
- id));
- table[id].pid = free_list_start;
- free_list_start = id;
- }
+ {
+ GNUNET_break (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_remove (map,
+ &table[id].
+ id.hashPubKey,
+ (void *) (long) id));
+ table[id].pid = free_list_start;
+ free_list_start = id;
+ }
}
@@ -229,11 +227,11 @@ void
GNUNET_PEER_resolve (GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid)
{
if (id == 0)
- {
- memset (pid, 0, sizeof (struct GNUNET_PeerIdentity));
- GNUNET_break (0);
- return;
- }
+ {
+ memset (pid, 0, sizeof (struct GNUNET_PeerIdentity));
+ GNUNET_break (0);
+ return;
+ }
GNUNET_assert (id < size);
GNUNET_assert (table[id].rc > 0);
*pid = table[id].id;