gnunet-svn
[Top][All Lists]
Advanced

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

[gnunet] branch master updated: indentation and style fixes


From: gnunet
Subject: [gnunet] branch master updated: indentation and style fixes
Date: Fri, 15 Jan 2021 20:18:57 +0100

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

grothoff pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new 184f6b151 indentation and style fixes
184f6b151 is described below

commit 184f6b151c2087a9870b32eab45b101ba79973d9
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Jan 15 20:18:09 2021 +0100

    indentation and style fixes
---
 src/hello/gnunet-hello.c |  2 +-
 src/setu/ibf.c           | 85 ++++++++++++++++++++++++++----------------------
 2 files changed, 48 insertions(+), 39 deletions(-)

diff --git a/src/hello/gnunet-hello.c b/src/hello/gnunet-hello.c
index b3f48322b..1f110ac18 100644
--- a/src/hello/gnunet-hello.c
+++ b/src/hello/gnunet-hello.c
@@ -51,7 +51,7 @@ static int address_count;
 
 
 /**
- * Add the given address with infinit expiration to the buffer.
+ * Add the given address with infinite expiration to the buffer.
  *
  * @param cls closure
  * @param address address to add
diff --git a/src/setu/ibf.c b/src/setu/ibf.c
index 1532afceb..f079722bd 100644
--- a/src/setu/ibf.c
+++ b/src/setu/ibf.c
@@ -164,7 +164,8 @@ ibf_insert_into (struct InvertibleBloomFilter *ibf,
  * @param key the element's hash code
  */
 void
-ibf_insert (struct InvertibleBloomFilter *ibf, struct IBF_Key key)
+ibf_insert (struct InvertibleBloomFilter *ibf,
+            struct IBF_Key key)
 {
   int buckets[ibf->hash_num];
 
@@ -181,7 +182,8 @@ ibf_insert (struct InvertibleBloomFilter *ibf, struct 
IBF_Key key)
  * @param key the element's hash code
  */
 void
-ibf_remove (struct InvertibleBloomFilter *ibf, struct IBF_Key key)
+ibf_remove (struct InvertibleBloomFilter *ibf,
+            struct IBF_Key key)
 {
   int buckets[ibf->hash_num];
 
@@ -197,9 +199,7 @@ ibf_remove (struct InvertibleBloomFilter *ibf, struct 
IBF_Key key)
 static int
 ibf_is_empty (struct InvertibleBloomFilter *ibf)
 {
-  int i;
-
-  for (i = 0; i < ibf->size; i++)
+  for (uint32_t i = 0; i < ibf->size; i++)
   {
     if (0 != ibf->count[i].count_val)
       return GNUNET_NO;
@@ -220,27 +220,25 @@ ibf_is_empty (struct InvertibleBloomFilter *ibf)
  *                 A negative sign indicates that the element was recovered
  *                 resides in an IBF that was previously subtracted from.
  * @param ret_id receives the hash code of the decoded element, if successful
- * @return GNUNET_YES if decoding an element was successful,
- *         GNUNET_NO if the IBF is empty,
- *         GNUNET_SYSERR if the decoding has failed
+ * @return #GNUNET_YES if decoding an element was successful,
+ *         #GNUNET_NO if the IBF is empty,
+ *         #GNUNET_SYSERR if the decoding has failed
  */
 int
 ibf_decode (struct InvertibleBloomFilter *ibf,
-            int *ret_side, struct IBF_Key *ret_id)
+            int *ret_side,
+            struct IBF_Key *ret_id)
 {
   struct IBF_KeyHash hash;
-  int i;
   int buckets[ibf->hash_num];
 
-  GNUNET_assert (NULL != ibf);
-
-  for (i = 0; i < ibf->size; i++)
+  for (uint32_t i = 0; i < ibf->size; i++)
   {
-    int j;
     int hit;
 
     /* we can only decode from pure buckets */
-    if ((1 != ibf->count[i].count_val) && (-1 != ibf->count[i].count_val))
+    if ( (1 != ibf->count[i].count_val) &&
+         (-1 != ibf->count[i].count_val) )
       continue;
 
     hash.key_hash_val = IBF_KEY_HASH_VAL (ibf->key_sum[i]);
@@ -253,7 +251,7 @@ ibf_decode (struct InvertibleBloomFilter *ibf,
      * if not, the key hash was subject to collision */
     hit = GNUNET_NO;
     ibf_get_indices (ibf, ibf->key_sum[i], buckets);
-    for (j = 0; j < ibf->hash_num; j++)
+    for (int j = 0; j < ibf->hash_num; j++)
       if (buckets[j] == i)
         hit = GNUNET_YES;
 
@@ -287,7 +285,8 @@ ibf_decode (struct InvertibleBloomFilter *ibf,
  * @param buf buffer to write the data to
  */
 void
-ibf_write_slice (const struct InvertibleBloomFilter *ibf, uint32_t start,
+ibf_write_slice (const struct InvertibleBloomFilter *ibf,
+                 uint32_t start,
                  uint32_t count, void *buf)
 {
   struct IBF_Key *key_dst;
@@ -298,16 +297,21 @@ ibf_write_slice (const struct InvertibleBloomFilter *ibf, 
uint32_t start,
 
   /* copy keys */
   key_dst = (struct IBF_Key *) buf;
-  GNUNET_memcpy (key_dst, ibf->key_sum + start, count * sizeof *key_dst);
+  GNUNET_memcpy (key_dst,
+                 ibf->key_sum + start,
+                 count * sizeof *key_dst);
   key_dst += count;
   /* copy key hashes */
   key_hash_dst = (struct IBF_KeyHash *) key_dst;
-  GNUNET_memcpy (key_hash_dst, ibf->key_hash_sum + start, count
-                 * sizeof *key_hash_dst);
+  GNUNET_memcpy (key_hash_dst,
+                 ibf->key_hash_sum + start,
+                 count * sizeof *key_hash_dst);
   key_hash_dst += count;
   /* copy counts */
   count_dst = (struct IBF_Count *) key_hash_dst;
-  GNUNET_memcpy (count_dst, ibf->count + start, count * sizeof *count_dst);
+  GNUNET_memcpy (count_dst,
+                 ibf->count + start,
+                 count * sizeof *count_dst);
 }
 
 
@@ -320,8 +324,10 @@ ibf_write_slice (const struct InvertibleBloomFilter *ibf, 
uint32_t start,
  * @param ibf the ibf to read from
  */
 void
-ibf_read_slice (const void *buf, uint32_t start, uint32_t count, struct
-                InvertibleBloomFilter *ibf)
+ibf_read_slice (const void *buf,
+                uint32_t start,
+                uint32_t count,
+                struct InvertibleBloomFilter *ibf)
 {
   struct IBF_Key *key_src;
   struct IBF_KeyHash *key_hash_src;
@@ -332,16 +338,21 @@ ibf_read_slice (const void *buf, uint32_t start, uint32_t 
count, struct
 
   /* copy keys */
   key_src = (struct IBF_Key *) buf;
-  GNUNET_memcpy (ibf->key_sum + start, key_src, count * sizeof *key_src);
+  GNUNET_memcpy (ibf->key_sum + start,
+                 key_src,
+                 count * sizeof *key_src);
   key_src += count;
   /* copy key hashes */
   key_hash_src = (struct IBF_KeyHash *) key_src;
-  GNUNET_memcpy (ibf->key_hash_sum + start, key_hash_src, count
-                 * sizeof *key_hash_src);
+  GNUNET_memcpy (ibf->key_hash_sum + start,
+                 key_hash_src,
+                 count * sizeof *key_hash_src);
   key_hash_src += count;
   /* copy counts */
   count_src = (struct IBF_Count *) key_hash_src;
-  GNUNET_memcpy (ibf->count + start, count_src, count * sizeof *count_src);
+  GNUNET_memcpy (ibf->count + start,
+                 count_src,
+                 count * sizeof *count_src);
 }
 
 
@@ -353,15 +364,13 @@ ibf_read_slice (const void *buf, uint32_t start, uint32_t 
count, struct
  * @param ibf2 IBF that will be subtracted from ibf1
  */
 void
-ibf_subtract (struct InvertibleBloomFilter *ibf1, const struct
-              InvertibleBloomFilter *ibf2)
+ibf_subtract (struct InvertibleBloomFilter *ibf1,
+              const struct InvertibleBloomFilter *ibf2)
 {
-  int i;
-
   GNUNET_assert (ibf1->size == ibf2->size);
   GNUNET_assert (ibf1->hash_num == ibf2->hash_num);
 
-  for (i = 0; i < ibf1->size; i++)
+  for (uint32_t i = 0; i < ibf1->size; i++)
   {
     ibf1->count[i].count_val -= ibf2->count[i].count_val;
     ibf1->key_hash_sum[i].key_hash_val ^= ibf2->key_hash_sum[i].key_hash_val;
@@ -383,12 +392,12 @@ ibf_dup (const struct InvertibleBloomFilter *ibf)
   copy = GNUNET_malloc (sizeof *copy);
   copy->hash_num = ibf->hash_num;
   copy->size = ibf->size;
-  copy->key_hash_sum = GNUNET_memdup (ibf->key_hash_sum, ibf->size
-                                      * sizeof(struct IBF_KeyHash));
-  copy->key_sum = GNUNET_memdup (ibf->key_sum, ibf->size * sizeof(struct
-                                                                  IBF_Key));
-  copy->count = GNUNET_memdup (ibf->count, ibf->size * sizeof(struct
-                                                              IBF_Count));
+  copy->key_hash_sum = GNUNET_memdup (ibf->key_hash_sum,
+                                      ibf->size * sizeof(struct IBF_KeyHash));
+  copy->key_sum = GNUNET_memdup (ibf->key_sum,
+                                 ibf->size * sizeof(struct IBF_Key));
+  copy->count = GNUNET_memdup (ibf->count,
+                               ibf->size * sizeof(struct IBF_Count));
   return copy;
 }
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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