gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] branch master updated (5a065f662 -> fbb71d527)


From: gnunet
Subject: [GNUnet-SVN] [gnunet] branch master updated (5a065f662 -> fbb71d527)
Date: Sat, 05 Oct 2019 15:04:20 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository gnunet.

    from 5a065f662 fix hook to only apply to C code
     new 8ee21de88 reduce scope
     new b1a2566fc reduce scope
     new 968e36dc3 reduce scope
     new eb7335e9a reduce scope
     new fbb71d527 reduce scope

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 contrib/uncrustify_precommit |   2 +-
 src/util/configuration.c     |   6 +-
 src/util/peer.c              | 140 +++++++++++++++++++++----------------------
 3 files changed, 75 insertions(+), 73 deletions(-)

diff --git a/contrib/uncrustify_precommit b/contrib/uncrustify_precommit
index bfea10304..fd29998c3 100755
--- a/contrib/uncrustify_precommit
+++ b/contrib/uncrustify_precommit
@@ -17,7 +17,7 @@ do
     # only change any of the invocations here if
     # they are portable across all cmp and shell
     # implementations !
-    uncrustify - q - c uncrustify.cfg - f $f | cmp - s $f -
+    uncrustify -q -c uncrustify.cfg -f $f | cmp -s $f -
     if test $? = 1 ;
     then
       crustified=" $crustified $f"
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 4e7659276..6d72d4fe0 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -427,7 +427,6 @@ GNUNET_CONFIGURATION_serialize(const struct 
GNUNET_CONFIGURATION_Handle *cfg,
   char *cbuf;
   char *val;
   char *pos;
-  int len;
   size_t m_size;
   size_t c_size;
 
@@ -464,6 +463,8 @@ GNUNET_CONFIGURATION_serialize(const struct 
GNUNET_CONFIGURATION_Handle *cfg,
   *size = c_size;
   while (NULL != sec)
     {
+      int len;
+
       len = GNUNET_asprintf(&cbuf, "[%s]\n", sec->name);
       GNUNET_assert(0 < len);
       GNUNET_memcpy(mem + c_size, cbuf, len);
@@ -1166,7 +1167,6 @@ expand_dollar(const struct GNUNET_CONFIGURATION_Handle 
*cfg,
               char *orig,
               unsigned int depth)
 {
-  int i;
   char *prefix;
   char *result;
   char *start;
@@ -1242,6 +1242,8 @@ expand_dollar(const struct GNUNET_CONFIGURATION_Handle 
*cfg,
     }
   else
     {
+      int i;
+
       start = &orig[1];
       def = NULL;
       i = 0;
diff --git a/src/util/peer.c b/src/util/peer.c
index 09347cbfd..3216f1a57 100644
--- a/src/util/peer.c
+++ b/src/util/peer.c
@@ -26,10 +26,11 @@
 #include "platform.h"
 #include "gnunet_peer_lib.h"
 
-#define LOG(kind, ...) GNUNET_log_from(kind, "util-peer", __VA_ARGS__)
+#define LOG(kind, ...) GNUNET_log_from (kind, "util-peer", __VA_ARGS__)
 
 
-struct PeerEntry {
+struct PeerEntry
+{
   /**
    * The identifier itself
    */
@@ -79,7 +80,7 @@ static unsigned int free_list_start;
  * @return the interned identity or 0.
  */
 GNUNET_PEER_Id
-GNUNET_PEER_search(const struct GNUNET_PeerIdentity *pid)
+GNUNET_PEER_search (const struct GNUNET_PeerIdentity *pid)
 {
   struct PeerEntry *e;
 
@@ -87,10 +88,10 @@ GNUNET_PEER_search(const struct GNUNET_PeerIdentity *pid)
     return 0;
   if (NULL == map)
     return 0;
-  e = GNUNET_CONTAINER_multipeermap_get(map, pid);
+  e = GNUNET_CONTAINER_multipeermap_get (map, pid);
   if (NULL == e)
     return 0;
-  GNUNET_assert(e->rc > 0);
+  GNUNET_assert (e->rc > 0);
   return e->pid;
 }
 
@@ -103,51 +104,50 @@ 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;
-  unsigned int i;
 
   if (NULL == pid)
     return 0;
   if (NULL == map)
-    map = GNUNET_CONTAINER_multipeermap_create(32, GNUNET_YES);
-  e = GNUNET_CONTAINER_multipeermap_get(map, pid);
+    map = GNUNET_CONTAINER_multipeermap_create (32, GNUNET_YES);
+  e = GNUNET_CONTAINER_multipeermap_get (map, pid);
   if (NULL != e)
-    {
-      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 (unsigned int i = ret; i < size; i++)
     {
-      GNUNET_array_grow(table, size, size + 16);
-      for (i = ret; i < size; i++)
-        {
-          table[i] = GNUNET_new(struct PeerEntry);
-          table[i]->pid = i + 1;
-        }
+      table[i] = GNUNET_new (struct PeerEntry);
+      table[i]->pid = i + 1;
     }
+  }
   if (0 == ret)
-    {
-      memset(&table[0]->id, 0, sizeof(struct GNUNET_PeerIdentity));
-      table[0]->pid = 0;
-      table[0]->rc = 1;
-      ret = 1;
-    }
-  GNUNET_assert(ret < size);
-  GNUNET_assert(0 == table[ret]->rc);
+  {
+    memset (&table[0]->id, 0, sizeof(struct GNUNET_PeerIdentity));
+    table[0]->pid = 0;
+    table[0]->rc = 1;
+    ret = 1;
+  }
+  GNUNET_assert (ret < size);
+  GNUNET_assert (0 == table[ret]->rc);
   free_list_start = table[ret]->pid;
   table[ret]->id = *pid;
   table[ret]->rc = 1;
   table[ret]->pid = ret;
-  GNUNET_break(GNUNET_OK ==
-               GNUNET_CONTAINER_multipeermap_put(map,
-                                                 &table[ret]->id,
-                                                 table[ret],
-                                                 
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
+  GNUNET_break (GNUNET_OK ==
+                GNUNET_CONTAINER_multipeermap_put (map,
+                                                   &table[ret]->id,
+                                                   table[ret],
+                                                   
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
   return ret;
 }
 
@@ -159,7 +159,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;
@@ -167,23 +167,23 @@ GNUNET_PEER_decrement_rcs(const GNUNET_PEER_Id *ids, 
unsigned int count)
   if (0 == count)
     return;
   for (i = count - 1; i >= 0; i--)
+  {
+    id = ids[i];
+    if (0 == id)
+      continue;
+    GNUNET_assert (id < size);
+    GNUNET_assert (table[id]->rc > 0);
+    table[id]->rc--;
+    if (0 == table[id]->rc)
     {
-      id = ids[i];
-      if (0 == id)
-        continue;
-      GNUNET_assert(id < size);
-      GNUNET_assert(table[id]->rc > 0);
-      table[id]->rc--;
-      if (0 == table[id]->rc)
-        {
-          GNUNET_break(GNUNET_OK ==
-                       GNUNET_CONTAINER_multipeermap_remove(map,
-                                                            &table[id]->id,
-                                                            table[id]));
-          table[id]->pid = free_list_start;
-          free_list_start = id;
-        }
+      GNUNET_break (GNUNET_OK ==
+                    GNUNET_CONTAINER_multipeermap_remove (map,
+                                                          &table[id]->id,
+                                                          table[id]));
+      table[id]->pid = free_list_start;
+      free_list_start = id;
     }
+  }
 }
 
 
@@ -194,24 +194,24 @@ GNUNET_PEER_decrement_rcs(const GNUNET_PEER_Id *ids, 
unsigned int count)
  * @param delta how much to change the RC
  */
 void
-GNUNET_PEER_change_rc(GNUNET_PEER_Id id, int delta)
+GNUNET_PEER_change_rc (GNUNET_PEER_Id id, int delta)
 {
   if (0 == id)
     return;
-  GNUNET_assert(id < size);
-  GNUNET_assert(table[id]->rc > 0);
-  GNUNET_assert((delta >= 0) ||
-                (table[id]->rc >= (unsigned int)(-delta)));
+  GNUNET_assert (id < size);
+  GNUNET_assert (table[id]->rc > 0);
+  GNUNET_assert ((delta >= 0) ||
+                 (table[id]->rc >= (unsigned int) (-delta)));
   table[id]->rc += delta;
   if (0 == table[id]->rc)
-    {
-      GNUNET_break(GNUNET_OK ==
-                   GNUNET_CONTAINER_multipeermap_remove(map,
+  {
+    GNUNET_break (GNUNET_OK ==
+                  GNUNET_CONTAINER_multipeermap_remove (map,
                                                         &table[id]->id,
                                                         table[id]));
-      table[id]->pid = free_list_start;
-      free_list_start = id;
-    }
+    table[id]->pid = free_list_start;
+    free_list_start = id;
+  }
 }
 
 
@@ -222,15 +222,15 @@ GNUNET_PEER_change_rc(GNUNET_PEER_Id id, int delta)
  * @param pid where to write the normal peer identity
  */
 void
-GNUNET_PEER_resolve(GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid)
+GNUNET_PEER_resolve (GNUNET_PEER_Id id, struct GNUNET_PeerIdentity *pid)
 {
   if (0 == id)
-    {
-      memset(pid, 0, sizeof(struct GNUNET_PeerIdentity));
-      return;
-    }
-  GNUNET_assert(id < size);
-  GNUNET_assert(table[id]->rc > 0);
+  {
+    memset (pid, 0, sizeof(struct GNUNET_PeerIdentity));
+    return;
+  }
+  GNUNET_assert (id < size);
+  GNUNET_assert (table[id]->rc > 0);
   *pid = table[id]->id;
 }
 
@@ -242,10 +242,10 @@ GNUNET_PEER_resolve(GNUNET_PEER_Id id, struct 
GNUNET_PeerIdentity *pid)
  * @return pointer to peer identity, valid as long 'id' is valid
  */
 const struct GNUNET_PeerIdentity *
-GNUNET_PEER_resolve2(GNUNET_PEER_Id id)
+GNUNET_PEER_resolve2 (GNUNET_PEER_Id id)
 {
-  GNUNET_assert(id < size);
-  GNUNET_assert(table[id]->rc > 0);
+  GNUNET_assert (id < size);
+  GNUNET_assert (table[id]->rc > 0);
   return &table[id]->id;
 }
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]