aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-04-06 14:37:07 +0200
committerChristian Grothoff <christian@grothoff.org>2019-04-06 14:37:07 +0200
commitc57caa206c761424b73e900978edff0a1b8fca50 (patch)
tree66641306c9a1d196dfe9f82c863bada50fb86187
parentc0d08bbdeed4523cf89bf55b64ce2c16476c3e26 (diff)
downloadgnunet-c57caa206c761424b73e900978edff0a1b8fca50.tar.gz
gnunet-c57caa206c761424b73e900978edff0a1b8fca50.zip
introduce GNUNET_memcmp() and GNUNET_is_zero()
-rw-r--r--ChangeLog4
-rw-r--r--src/cadet/gnunet-service-cadet_tunnels.c6
-rw-r--r--src/fs/gnunet-service-fs.c2
-rw-r--r--src/fs/gnunet-service-fs_cp.c2
-rw-r--r--src/include/gnunet_cadet_service.h2
-rw-r--r--src/include/gnunet_common.h26
-rw-r--r--src/include/gnunet_crypto_lib.h16
-rw-r--r--src/rps/gnunet-service-rps.c6
-rw-r--r--src/rps/gnunet-service-rps_sampler_elem.c2
-rw-r--r--src/rps/rps-sampler_common.c4
-rw-r--r--src/util/crypto_ecc.c23
-rw-r--r--src/util/service.c8
-rw-r--r--src/util/test_peer.c37
13 files changed, 66 insertions, 72 deletions
diff --git a/ChangeLog b/ChangeLog
index 31b0b637e..9d2d27a05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
1Sat 06 Apr 2019 02:36:17 PM CEST
2 Introducing GNUNET_memcmp() and GNUNET_is_zero() for better typing
3 when comparing memory areas. -CG
4
1Fri 05 Apr 2019 11:38:53 PM CEST 5Fri 05 Apr 2019 11:38:53 PM CEST
2 Use paths of sysctl, ip, ifconfig and ip(6)tables from configure 6 Use paths of sysctl, ip, ifconfig and ip(6)tables from configure
3 if they work. (#5352). -CG 7 if they work. (#5352). -CG
diff --git a/src/cadet/gnunet-service-cadet_tunnels.c b/src/cadet/gnunet-service-cadet_tunnels.c
index ad4ed6e96..57a6d1adf 100644
--- a/src/cadet/gnunet-service-cadet_tunnels.c
+++ b/src/cadet/gnunet-service-cadet_tunnels.c
@@ -467,10 +467,10 @@ struct CadetTunnel
467static int 467static int
468alice_or_betty (const struct GNUNET_PeerIdentity *other) 468alice_or_betty (const struct GNUNET_PeerIdentity *other)
469{ 469{
470 if (0 > GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, 470 if (0 > GNUNET_memcmp (&my_full_id,
471 other)) 471 other))
472 return GNUNET_YES; 472 return GNUNET_YES;
473 else if (0 < GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, 473 else if (0 < GNUNET_memcmp (&my_full_id,
474 other)) 474 other))
475 return GNUNET_NO; 475 return GNUNET_NO;
476 else 476 else
@@ -2077,7 +2077,7 @@ get_next_free_ctn (struct CadetTunnel *t)
2077 int cmp; 2077 int cmp;
2078 uint32_t highbit; 2078 uint32_t highbit;
2079 2079
2080 cmp = GNUNET_CRYPTO_cmp_peer_identity (&my_full_id, 2080 cmp = GNUNET_memcmp (&my_full_id,
2081 GCP_get_id (GCT_get_destination (t))); 2081 GCP_get_id (GCT_get_destination (t)));
2082 if (0 < cmp) 2082 if (0 < cmp)
2083 highbit = HIGH_BIT; 2083 highbit = HIGH_BIT;
diff --git a/src/fs/gnunet-service-fs.c b/src/fs/gnunet-service-fs.c
index b9ccf7c55..691242ce3 100644
--- a/src/fs/gnunet-service-fs.c
+++ b/src/fs/gnunet-service-fs.c
@@ -1224,7 +1224,7 @@ static void
1224peer_init_handler (void *cls, 1224peer_init_handler (void *cls,
1225 const struct GNUNET_PeerIdentity *my_identity) 1225 const struct GNUNET_PeerIdentity *my_identity)
1226{ 1226{
1227 if (0 != GNUNET_CRYPTO_cmp_peer_identity (&GSF_my_id, 1227 if (0 != GNUNET_memcmp (&GSF_my_id,
1228 my_identity)) 1228 my_identity))
1229 { 1229 {
1230 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1230 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/fs/gnunet-service-fs_cp.c b/src/fs/gnunet-service-fs_cp.c
index 6486732a6..a3a521221 100644
--- a/src/fs/gnunet-service-fs_cp.c
+++ b/src/fs/gnunet-service-fs_cp.c
@@ -588,7 +588,7 @@ GSF_peer_connect_handler (void *cls,
588 struct GSF_ConnectedPeer *cp; 588 struct GSF_ConnectedPeer *cp;
589 589
590 if (0 == 590 if (0 ==
591 GNUNET_CRYPTO_cmp_peer_identity (&GSF_my_id, 591 GNUNET_memcmp (&GSF_my_id,
592 peer)) 592 peer))
593 return NULL; 593 return NULL;
594 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 594 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
diff --git a/src/include/gnunet_cadet_service.h b/src/include/gnunet_cadet_service.h
index b8326657d..da914ac9e 100644
--- a/src/include/gnunet_cadet_service.h
+++ b/src/include/gnunet_cadet_service.h
@@ -89,7 +89,7 @@ struct GNUNET_CADET_ChannelTunnelNumber
89 * Given two peers, both may initiate channels over the same tunnel. 89 * Given two peers, both may initiate channels over the same tunnel.
90 * The @e cn must be greater or equal to 0x80000000 (high-bit set) 90 * The @e cn must be greater or equal to 0x80000000 (high-bit set)
91 * for tunnels initiated with the peer that has the larger peer 91 * for tunnels initiated with the peer that has the larger peer
92 * identity as compared using #GNUNET_CRYPTO_cmp_peer_identity(). 92 * identity as compared using #GNUNET_memcmp().
93 */ 93 */
94 uint32_t cn GNUNET_PACKED; 94 uint32_t cn GNUNET_PACKED;
95}; 95};
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index ca49d3109..773ff8f3e 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -913,6 +913,32 @@ GNUNET_ntoh_double (double d);
913 */ 913 */
914#define GNUNET_new(type) (type *) GNUNET_malloc (sizeof (type)) 914#define GNUNET_new(type) (type *) GNUNET_malloc (sizeof (type))
915 915
916
917/**
918 * Compare memory in @a a and @a b, where both must be of
919 * the same pointer type.
920 */
921#define GNUNET_memcmp(a,b) ({ \
922 typeof(b) _a = (a); \
923 typeof(a) _b = (b); \
924 memcmp(_a, \
925 _b, \
926 sizeof (*a)); })
927
928
929/**
930 * Check that memory in @a a is all zeros. @a a must be a pointer.
931 *
932 * @param a pointer to a struct which should be tested for the
933 * entire memory being zero'ed out.
934 */
935#define GNUNET_is_zero(a) ({ \
936 typeof(*a) _z = { 0 }; \
937 memcmp(a, \
938 &_z, \
939 sizeof (_z)); })
940
941
916/** 942/**
917 * Call memcpy() but check for @a n being 0 first. In the latter 943 * Call memcpy() but check for @a n being 0 first. In the latter
918 * case, it is now safe to pass NULL for @a src or @a dst. 944 * case, it is now safe to pass NULL for @a src or @a dst.
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 6a9eddd7c..c6ae943b9 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -1355,20 +1355,6 @@ GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg,
1355 1355
1356 1356
1357/** 1357/**
1358 * Compare two Peer Identities.
1359 *
1360 * @param first first peer identity
1361 * @param second second peer identity
1362 * @return bigger than 0 if first > second,
1363 * 0 if they are the same
1364 * smaller than 0 if second > first
1365 */
1366int
1367GNUNET_CRYPTO_cmp_peer_identity (const struct GNUNET_PeerIdentity *first,
1368 const struct GNUNET_PeerIdentity *second);
1369
1370
1371/**
1372 * Internal structure used to cache pre-calculated values for DLOG calculation. 1358 * Internal structure used to cache pre-calculated values for DLOG calculation.
1373 */ 1359 */
1374struct GNUNET_CRYPTO_EccDlogContext; 1360struct GNUNET_CRYPTO_EccDlogContext;
@@ -1397,7 +1383,7 @@ struct GNUNET_CRYPTO_EccPoint
1397 */ 1383 */
1398struct GNUNET_CRYPTO_EccDlogContext * 1384struct GNUNET_CRYPTO_EccDlogContext *
1399GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max, 1385GNUNET_CRYPTO_ecc_dlog_prepare (unsigned int max,
1400 unsigned int mem); 1386 unsigned int mem);
1401 1387
1402 1388
1403/** 1389/**
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 1871ef006..f6fe17589 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -2161,7 +2161,7 @@ rem_from_list (struct GNUNET_PeerIdentity **peer_list,
2161 2161
2162 for ( i = 0 ; i < *list_size ; i++ ) 2162 for ( i = 0 ; i < *list_size ; i++ )
2163 { 2163 {
2164 if (0 == GNUNET_CRYPTO_cmp_peer_identity (&tmp[i], peer)) 2164 if (0 == GNUNET_memcmp (&tmp[i], peer))
2165 { 2165 {
2166 if (i < *list_size -1) 2166 if (i < *list_size -1)
2167 { /* Not at the last entry -- shift peers left */ 2167 { /* Not at the last entry -- shift peers left */
@@ -2742,7 +2742,7 @@ clean_peer (struct Sub *sub,
2742 "Going to remove send channel to peer %s\n", 2742 "Going to remove send channel to peer %s\n",
2743 GNUNET_i2s (peer)); 2743 GNUNET_i2s (peer));
2744 #if ENABLE_MALICIOUS 2744 #if ENABLE_MALICIOUS
2745 if (0 != GNUNET_CRYPTO_cmp_peer_identity (&attacked_peer, 2745 if (0 != GNUNET_memcmp (&attacked_peer,
2746 peer)) 2746 peer))
2747 (void) destroy_sending_channel (get_peer_ctx (sub->peer_map, 2747 (void) destroy_sending_channel (get_peer_ctx (sub->peer_map,
2748 peer)); 2748 peer));
@@ -3596,7 +3596,7 @@ handle_peer_pull_request (void *cls,
3596 3596
3597 else if (2 == mal_type) 3597 else if (2 == mal_type)
3598 { /* Try to partition network */ 3598 { /* Try to partition network */
3599 if (0 == GNUNET_CRYPTO_cmp_peer_identity (&attacked_peer, peer)) 3599 if (0 == GNUNET_memcmp (&attacked_peer, peer))
3600 { 3600 {
3601 send_pull_reply (peer_ctx, mal_peers, num_mal_peers); 3601 send_pull_reply (peer_ctx, mal_peers, num_mal_peers);
3602 } 3602 }
diff --git a/src/rps/gnunet-service-rps_sampler_elem.c b/src/rps/gnunet-service-rps_sampler_elem.c
index 737b7ee7f..9487c5f2e 100644
--- a/src/rps/gnunet-service-rps_sampler_elem.c
+++ b/src/rps/gnunet-service-rps_sampler_elem.c
@@ -111,7 +111,7 @@ RPS_sampler_elem_next (struct RPS_SamplerElement *sampler_elem,
111 111
112 sampler_elem->num_peers++; 112 sampler_elem->num_peers++;
113 113
114 if (0 == GNUNET_CRYPTO_cmp_peer_identity (new_ID, &(sampler_elem->peer_id))) 114 if (0 == GNUNET_memcmp (new_ID, &(sampler_elem->peer_id)))
115 { 115 {
116 LOG (GNUNET_ERROR_TYPE_DEBUG, "Have already PeerID %s\n", 116 LOG (GNUNET_ERROR_TYPE_DEBUG, "Have already PeerID %s\n",
117 GNUNET_i2s (&(sampler_elem->peer_id))); 117 GNUNET_i2s (&(sampler_elem->peer_id)));
diff --git a/src/rps/rps-sampler_common.c b/src/rps/rps-sampler_common.c
index 3ed4ef989..f54de9014 100644
--- a/src/rps/rps-sampler_common.c
+++ b/src/rps/rps-sampler_common.c
@@ -286,7 +286,7 @@ RPS_sampler_reinitialise_by_value (struct RPS_Sampler *sampler,
286 286
287 for (i = 0; i < sampler->sampler_size; i++) 287 for (i = 0; i < sampler->sampler_size; i++)
288 { 288 {
289 if (0 == GNUNET_CRYPTO_cmp_peer_identity(id, 289 if (0 == GNUNET_memcmp(id,
290 &(sampler->sampler_elements[i]->peer_id)) ) 290 &(sampler->sampler_elements[i]->peer_id)) )
291 { 291 {
292 LOG (GNUNET_ERROR_TYPE_DEBUG, "Reinitialising sampler\n"); 292 LOG (GNUNET_ERROR_TYPE_DEBUG, "Reinitialising sampler\n");
@@ -314,7 +314,7 @@ RPS_sampler_count_id (struct RPS_Sampler *sampler,
314 count = 0; 314 count = 0;
315 for ( i = 0 ; i < sampler->sampler_size ; i++ ) 315 for ( i = 0 ; i < sampler->sampler_size ; i++ )
316 { 316 {
317 if ( 0 == GNUNET_CRYPTO_cmp_peer_identity (&sampler->sampler_elements[i]->peer_id, id) 317 if ( 0 == GNUNET_memcmp (&sampler->sampler_elements[i]->peer_id, id)
318 && EMPTY != sampler->sampler_elements[i]->is_empty) 318 && EMPTY != sampler->sampler_elements[i]->is_empty)
319 count++; 319 count++;
320 } 320 }
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c
index cf40522d6..339180dff 100644
--- a/src/util/crypto_ecc.c
+++ b/src/util/crypto_ecc.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -763,23 +763,6 @@ GNUNET_CRYPTO_ecdsa_key_get_anonymous ()
763 763
764 764
765/** 765/**
766 * Compare two Peer Identities.
767 *
768 * @param first first peer identity
769 * @param second second peer identity
770 * @return bigger than 0 if first > second,
771 * 0 if they are the same
772 * smaller than 0 if second > first
773 */
774int
775GNUNET_CRYPTO_cmp_peer_identity (const struct GNUNET_PeerIdentity *first,
776 const struct GNUNET_PeerIdentity *second)
777{
778 return memcmp (first, second, sizeof (struct GNUNET_PeerIdentity));
779}
780
781
782/**
783 * Convert the data specified in the given purpose argument to an 766 * Convert the data specified in the given purpose argument to an
784 * S-expression suitable for signature operations. 767 * S-expression suitable for signature operations.
785 * 768 *
@@ -795,7 +778,7 @@ data_to_eddsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose)
795/* SEE #5398 */ 778/* SEE #5398 */
796#if 1 779#if 1
797 struct GNUNET_HashCode hc; 780 struct GNUNET_HashCode hc;
798 781
799 GNUNET_CRYPTO_hash (purpose, 782 GNUNET_CRYPTO_hash (purpose,
800 ntohl (purpose->size), 783 ntohl (purpose->size),
801 &hc); 784 &hc);
@@ -823,7 +806,7 @@ data_to_eddsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose)
823 rc); 806 rc);
824 return NULL; 807 return NULL;
825 } 808 }
826#endif 809#endif
827 return data; 810 return data;
828} 811}
829 812
diff --git a/src/util/service.c b/src/util/service.c
index b2e3e89cc..4fd16f93d 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -473,18 +473,12 @@ check_ipv6_listed (const struct GNUNET_STRINGS_IPv6NetworkPolicy *list,
473{ 473{
474 unsigned int i; 474 unsigned int i;
475 unsigned int j; 475 unsigned int j;
476 struct in6_addr zero;
477 476
478 if (NULL == list) 477 if (NULL == list)
479 return GNUNET_NO; 478 return GNUNET_NO;
480 memset (&zero,
481 0,
482 sizeof (struct in6_addr));
483 i = 0; 479 i = 0;
484NEXT: 480NEXT:
485 while (0 != memcmp (&zero, 481 while (0 != GNUNET_is_zero (&list[i].network))
486 &list[i].network,
487 sizeof (struct in6_addr)))
488 { 482 {
489 for (j = 0; j < sizeof (struct in6_addr) / sizeof (int); j++) 483 for (j = 0; j < sizeof (struct in6_addr) / sizeof (int); j++)
490 if (((((int *) ip)[j] & ((int *) &list[i].netmask)[j])) != 484 if (((((int *) ip)[j] & ((int *) &list[i].netmask)[j])) !=
diff --git a/src/util/test_peer.c b/src/util/test_peer.c
index 9fbedb15c..248836b4c 100644
--- a/src/util/test_peer.c
+++ b/src/util/test_peer.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -38,15 +38,15 @@ static struct GNUNET_PeerIdentity pidArr[NUMBER_OF_PEERS];
38static void 38static void
39generatePeerIdList () 39generatePeerIdList ()
40{ 40{
41 int i; 41 for (unsigned int i = 0; i < NUMBER_OF_PEERS; i++)
42
43 for (i = 0; i < NUMBER_OF_PEERS; i++)
44 { 42 {
45 gcry_randomize (&pidArr[i], 43 gcry_randomize (&pidArr[i],
46 sizeof (struct GNUNET_PeerIdentity), 44 sizeof (struct GNUNET_PeerIdentity),
47 GCRY_STRONG_RANDOM); 45 GCRY_STRONG_RANDOM);
48 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 46 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
49 "Peer %d: %s\n", i, GNUNET_i2s (&pidArr[i])); 47 "Peer %u: %s\n",
48 i,
49 GNUNET_i2s (&pidArr[i]));
50 } 50 }
51} 51}
52 52
@@ -54,15 +54,13 @@ generatePeerIdList ()
54static int 54static int
55check () 55check ()
56{ 56{
57 int i;
58 GNUNET_PEER_Id pid; 57 GNUNET_PEER_Id pid;
59 struct GNUNET_PeerIdentity res; 58 struct GNUNET_PeerIdentity res;
60 struct GNUNET_PeerIdentity zero;
61 GNUNET_PEER_Id ids[] = { 1, 2, 3 }; 59 GNUNET_PEER_Id ids[] = { 1, 2, 3 };
62 60
63 GNUNET_assert (0 == GNUNET_PEER_intern (NULL)); 61 GNUNET_assert (0 == GNUNET_PEER_intern (NULL));
64 /* Insert Peers into PeerEntry table and hashmap */ 62 /* Insert Peers into PeerEntry table and hashmap */
65 for (i = 0; i < NUMBER_OF_PEERS; i++) 63 for (unsigned int i = 0; i < NUMBER_OF_PEERS; i++)
66 { 64 {
67 pid = GNUNET_PEER_intern (&pidArr[i]); 65 pid = GNUNET_PEER_intern (&pidArr[i]);
68 if (pid != (i + 1)) 66 if (pid != (i + 1))
@@ -73,7 +71,7 @@ check ()
73 } 71 }
74 72
75 /* Referencing the first 3 peers once again */ 73 /* Referencing the first 3 peers once again */
76 for (i = 0; i < 3; i++) 74 for (unsigned int i = 0; i < 3; i++)
77 { 75 {
78 pid = GNUNET_PEER_intern (&pidArr[i]); 76 pid = GNUNET_PEER_intern (&pidArr[i]);
79 if (pid != (i + 1)) 77 if (pid != (i + 1))
@@ -87,25 +85,28 @@ check ()
87 GNUNET_PEER_decrement_rcs (ids, 3); 85 GNUNET_PEER_decrement_rcs (ids, 3);
88 86
89 /* re-referencing the first 3 peers using the change_rc function */ 87 /* re-referencing the first 3 peers using the change_rc function */
90 for (i = 1; i <= 3; i++) 88 for (unsigned int i = 1; i <= 3; i++)
91 GNUNET_PEER_change_rc (i, 1); 89 GNUNET_PEER_change_rc (i, 1);
92 90
93 /* Removing the second Peer from the PeerEntry hash map */ 91 /* Removing the second Peer from the PeerEntry hash map */
94 GNUNET_PEER_change_rc (2, -2); 92 GNUNET_PEER_change_rc (2, -2);
95 93
96 /* convert the pid of the first PeerEntry into that of the third */ 94 /* convert the pid of the first PeerEntry into that of the third */
97 GNUNET_PEER_resolve (1, &res); 95 GNUNET_PEER_resolve (1,
98 GNUNET_assert (0 == memcmp (&res, &pidArr[0], sizeof (res))); 96 &res);
97 GNUNET_assert (0 ==
98 GNUNET_memcmp (&res,
99 &pidArr[0]));
99 100
100 /* 101 /*
101 * Attempt to convert pid = 0 (which is reserved) 102 * Attempt to convert pid = 0 (which is reserved)
102 * into a peer identity object, the peer identity memory 103 * into a peer identity object, the peer identity memory
103 * is expected to be set to zero 104 * is expected to be set to zero
104 */ 105 */
105 memset (&zero, 0, sizeof (struct GNUNET_PeerIdentity));
106 GNUNET_log_skip (1, GNUNET_YES); 106 GNUNET_log_skip (1, GNUNET_YES);
107 GNUNET_PEER_resolve (0, &res); 107 GNUNET_PEER_resolve (0, &res);
108 GNUNET_assert (0 == memcmp (&res, &zero, sizeof (res))); 108 GNUNET_assert (0 ==
109 GNUNET_is_zero (&res));
109 110
110 /* Removing peer entries 1 and 3 from table using the list decrement function */ 111 /* Removing peer entries 1 and 3 from table using the list decrement function */
111 /* If count = 0, nothing should be done whatsoever */ 112 /* If count = 0, nothing should be done whatsoever */
@@ -122,10 +123,10 @@ check ()
122int 123int
123main () 124main ()
124{ 125{
125 unsigned int i; 126 GNUNET_log_setup ("test-peer",
126 127 "ERROR",
127 GNUNET_log_setup ("test-peer", "ERROR", NULL); 128 NULL);
128 for (i = 0; i < 1; i++) 129 for (unsigned int i = 0; i < 1; i++)
129 { 130 {
130 generatePeerIdList (); 131 generatePeerIdList ();
131 if (0 != check ()) 132 if (0 != check ())