aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorJulius Bünger <buenger@mytum.de>2019-04-26 05:56:54 +0200
committerJulius Bünger <buenger@mytum.de>2019-04-26 05:56:54 +0200
commitf5f5a9f680df2cebe6435ec87650cb3cb6e3ef6e (patch)
tree94055d2c049a65b5ab6c61fd3c5867fe49f6f429 /src/namestore
parenta097690795f4f814de7cdbc97ef95fb899eeacd3 (diff)
downloadgnunet-f5f5a9f680df2cebe6435ec87650cb3cb6e3ef6e.tar.gz
gnunet-f5f5a9f680df2cebe6435ec87650cb3cb6e3ef6e.zip
memcmp() -> GNUNET_memcmp(), first take
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-service-namestore.c28
-rw-r--r--src/namestore/gnunet-zoneimport.c5
-rw-r--r--src/namestore/namestore_api.c5
-rw-r--r--src/namestore/namestore_api_monitor.c9
-rw-r--r--src/namestore/perf_namestore_api_zone_iteration.c5
-rw-r--r--src/namestore/plugin_namestore_heap.c10
-rw-r--r--src/namestore/test_namestore_api_lookup_nick.c2
-rw-r--r--src/namestore/test_namestore_api_lookup_private.c5
-rw-r--r--src/namestore/test_namestore_api_monitoring.c5
-rw-r--r--src/namestore/test_namestore_api_monitoring_existing.c5
-rw-r--r--src/namestore/test_namestore_api_zone_iteration.c10
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_nick.c4
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_specific_zone.c7
-rw-r--r--src/namestore/test_namestore_api_zone_iteration_stop.c4
-rw-r--r--src/namestore/test_namestore_api_zone_to_name.c5
-rw-r--r--src/namestore/test_plugin_namestore.c5
16 files changed, 45 insertions, 69 deletions
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 45be0fe75..d2a09087e 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -553,9 +553,8 @@ cache_nick (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
553 (oldest->last_used.abs_value_us > 553 (oldest->last_used.abs_value_us >
554 pos->last_used.abs_value_us) ) 554 pos->last_used.abs_value_us) )
555 oldest = pos; 555 oldest = pos;
556 if (0 == memcmp (zone, 556 if (0 == GNUNET_memcmp (zone,
557 &pos->zone, 557 &pos->zone))
558 sizeof (*zone)))
559 { 558 {
560 oldest = pos; 559 oldest = pos;
561 break; 560 break;
@@ -592,9 +591,8 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone)
592 { 591 {
593 struct NickCache *pos = &nick_cache[i]; 592 struct NickCache *pos = &nick_cache[i];
594 if ( (NULL != pos->rd) && 593 if ( (NULL != pos->rd) &&
595 (0 == memcmp (zone, 594 (0 == GNUNET_memcmp (zone,
596 &pos->zone, 595 &pos->zone)) )
597 sizeof (*zone))) )
598 { 596 {
599 nick = GNUNET_malloc (sizeof (*nick) + 597 nick = GNUNET_malloc (sizeof (*nick) +
600 pos->rd->data_size); 598 pos->rd->data_size);
@@ -1082,12 +1080,10 @@ continue_store_activity (struct StoreActivity *sa)
1082 NULL != zm; 1080 NULL != zm;
1083 zm = sa->zm_pos) 1081 zm = sa->zm_pos)
1084 { 1082 {
1085 if ( (0 != memcmp (&rp_msg->private_key, 1083 if ( (0 != GNUNET_memcmp (&rp_msg->private_key,
1086 &zm->zone, 1084 &zm->zone)) &&
1087 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) && 1085 (0 != GNUNET_memcmp (&zm->zone,
1088 (0 != memcmp (&zm->zone, 1086 &zero)) )
1089 &zero,
1090 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) )
1091 { 1087 {
1092 sa->zm_pos = zm->next; /* not interesting to this monitor */ 1088 sa->zm_pos = zm->next; /* not interesting to this monitor */
1093 continue; 1089 continue;
@@ -1921,9 +1917,7 @@ run_zone_iteration_round (struct ZoneIteration *zi,
1921 start = GNUNET_TIME_absolute_get (); 1917 start = GNUNET_TIME_absolute_get ();
1922 GNUNET_break (GNUNET_SYSERR != 1918 GNUNET_break (GNUNET_SYSERR !=
1923 GSN_database->iterate_records (GSN_database->cls, 1919 GSN_database->iterate_records (GSN_database->cls,
1924 (0 == memcmp (&zi->zone, 1920 (0 == GNUNET_is_zero (&zi->zone))
1925 &zero,
1926 sizeof (zero)))
1927 ? NULL 1921 ? NULL
1928 : &zi->zone, 1922 : &zi->zone,
1929 zi->seq, 1923 zi->seq,
@@ -2220,9 +2214,7 @@ monitor_iteration_next (void *cls)
2220 else 2214 else
2221 zm->iteration_cnt = zm->limit; /* use it all */ 2215 zm->iteration_cnt = zm->limit; /* use it all */
2222 ret = GSN_database->iterate_records (GSN_database->cls, 2216 ret = GSN_database->iterate_records (GSN_database->cls,
2223 (0 == memcmp (&zm->zone, 2217 (0 == GNUNET_is_zero (&zm->zone))
2224 &zero,
2225 sizeof (zero)))
2226 ? NULL 2218 ? NULL
2227 : &zm->zone, 2219 : &zm->zone,
2228 zm->seq, 2220 zm->seq,
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c
index e7d040ec4..f36106332 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -1583,9 +1583,8 @@ ns_lookup_result_cb (void *cls,
1583 GNUNET_CONTAINER_multihashmap_remove (ns_pending, 1583 GNUNET_CONTAINER_multihashmap_remove (ns_pending,
1584 &hc, 1584 &hc,
1585 req)); 1585 req));
1586 GNUNET_break (0 == memcmp (key, 1586 GNUNET_break (0 == GNUNET_memcmp (key,
1587 &req->zone->key, 1587 &req->zone->key));
1588 sizeof (*key)));
1589 GNUNET_break (0 == strcasecmp (label, 1588 GNUNET_break (0 == strcasecmp (label,
1590 get_label (req))); 1589 get_label (req)));
1591 for (unsigned int i=0;i<rd_count;i++) 1590 for (unsigned int i=0;i<rd_count;i++)
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index 89eb0afa4..99fd17473 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -552,9 +552,8 @@ check_record_result (void *cls,
552 GNUNET_break (0); 552 GNUNET_break (0);
553 return GNUNET_SYSERR; 553 return GNUNET_SYSERR;
554 } 554 }
555 if (0 == memcmp (&msg->private_key, 555 if (0 == GNUNET_memcmp (&msg->private_key,
556 &priv_dummy, 556 &priv_dummy) )
557 sizeof (priv_dummy)) )
558 { 557 {
559 GNUNET_break (0); 558 GNUNET_break (0);
560 return GNUNET_SYSERR; 559 return GNUNET_SYSERR;
diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c
index 67715f634..99e3864c9 100644
--- a/src/namestore/namestore_api_monitor.c
+++ b/src/namestore/namestore_api_monitor.c
@@ -142,12 +142,9 @@ check_result (void *cls,
142 const char *rd_ser_tmp; 142 const char *rd_ser_tmp;
143 143
144 (void) cls; 144 (void) cls;
145 if ( (0 != memcmp (&lrm->private_key, 145 if ( (0 != GNUNET_memcmp (&lrm->private_key,
146 &zm->zone, 146 &zm->zone)) &&
147 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) && 147 (0 != GNUNET_is_zero (&zm->zone)) )
148 (0 != memcmp (&zero,
149 &zm->zone,
150 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) )
151 { 148 {
152 GNUNET_break (0); 149 GNUNET_break (0);
153 return GNUNET_SYSERR; 150 return GNUNET_SYSERR;
diff --git a/src/namestore/perf_namestore_api_zone_iteration.c b/src/namestore/perf_namestore_api_zone_iteration.c
index 5da958aad..156f9227c 100644
--- a/src/namestore/perf_namestore_api_zone_iteration.c
+++ b/src/namestore/perf_namestore_api_zone_iteration.c
@@ -241,9 +241,8 @@ zone_proc (void *cls,
241 return; 241 return;
242 } 242 }
243 GNUNET_free (wrd); 243 GNUNET_free (wrd);
244 if (0 != memcmp (zone, 244 if (0 != GNUNET_memcmp (zone,
245 privkey, 245 privkey))
246 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
247 { 246 {
248 res = 5; 247 res = 5;
249 GNUNET_break (0); 248 GNUNET_break (0);
diff --git a/src/namestore/plugin_namestore_heap.c b/src/namestore/plugin_namestore_heap.c
index 01cf592ea..8fe03764d 100644
--- a/src/namestore/plugin_namestore_heap.c
+++ b/src/namestore/plugin_namestore_heap.c
@@ -592,9 +592,8 @@ iterate_zones (void *cls,
592 if (0 == ic->limit) 592 if (0 == ic->limit)
593 return GNUNET_NO; 593 return GNUNET_NO;
594 if ( (NULL != ic->zone) && 594 if ( (NULL != ic->zone) &&
595 (0 != memcmp (&entry->private_key, 595 (0 != GNUNET_memcmp (&entry->private_key,
596 ic->zone, 596 ic->zone)) )
597 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) )
598 return GNUNET_YES; 597 return GNUNET_YES;
599 ic->pos++; 598 ic->pos++;
600 if (ic->offset > 0) 599 if (ic->offset > 0)
@@ -676,9 +675,8 @@ zone_to_name (void *cls,
676 struct FlatFileEntry *entry = value; 675 struct FlatFileEntry *entry = value;
677 676
678 (void) key; 677 (void) key;
679 if (0 != memcmp (&entry->private_key, 678 if (0 != GNUNET_memcmp (&entry->private_key,
680 ztn->zone, 679 ztn->zone))
681 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
682 return GNUNET_YES; 680 return GNUNET_YES;
683 681
684 for (unsigned int i = 0; i < entry->record_count; i++) 682 for (unsigned int i = 0; i < entry->record_count; i++)
diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c
index 1257701e9..392a2521d 100644
--- a/src/namestore/test_namestore_api_lookup_nick.c
+++ b/src/namestore/test_namestore_api_lookup_nick.c
@@ -111,7 +111,7 @@ lookup_it (void *cls,
111 int found_record = GNUNET_NO; 111 int found_record = GNUNET_NO;
112 int found_nick = GNUNET_NO; 112 int found_nick = GNUNET_NO;
113 113
114 if (0 != memcmp(privkey, zone, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) 114 if (0 != GNUNET_memcmp(privkey, zone))
115 { 115 {
116 GNUNET_break(0); 116 GNUNET_break(0);
117 GNUNET_SCHEDULER_cancel (endbadly_task); 117 GNUNET_SCHEDULER_cancel (endbadly_task);
diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c
index 2615f52c8..cf9bfc20c 100644
--- a/src/namestore/test_namestore_api_lookup_private.c
+++ b/src/namestore/test_namestore_api_lookup_private.c
@@ -103,9 +103,8 @@ lookup_it (void *cls,
103{ 103{
104 nsqe = NULL; 104 nsqe = NULL;
105 105
106 if (0 != memcmp (privkey, 106 if (0 != GNUNET_memcmp (privkey,
107 zone, 107 zone))
108 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
109 { 108 {
110 GNUNET_break(0); 109 GNUNET_break(0);
111 GNUNET_SCHEDULER_cancel (endbadly_task); 110 GNUNET_SCHEDULER_cancel (endbadly_task);
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c
index c85ec8457..8fbeb6479 100644
--- a/src/namestore/test_namestore_api_monitoring.c
+++ b/src/namestore/test_namestore_api_monitoring.c
@@ -156,9 +156,8 @@ zone_proc (void *cls,
156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
157 "Comparing results name %s\n", 157 "Comparing results name %s\n",
158 name); 158 name);
159 if (0 != memcmp (zone_key, 159 if (0 != GNUNET_memcmp (zone_key,
160 privkey, 160 privkey))
161 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
162 { 161 {
163 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 162 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
164 "Monitoring returned wrong zone key\n"); 163 "Monitoring returned wrong zone key\n");
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c
index 64bfb6949..e54046c85 100644
--- a/src/namestore/test_namestore_api_monitoring_existing.c
+++ b/src/namestore/test_namestore_api_monitoring_existing.c
@@ -150,9 +150,8 @@ zone_proc (void *cls,
150 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 150 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
151 "Comparing results name %s\n", 151 "Comparing results name %s\n",
152 name); 152 name);
153 if (0 != memcmp (zone_key, 153 if (0 != GNUNET_memcmp (zone_key,
154 privkey, 154 privkey))
155 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
156 { 155 {
157 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 156 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
158 "Monitoring returned wrong zone key\n"); 157 "Monitoring returned wrong zone key\n");
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c
index fa641954b..94331f89e 100644
--- a/src/namestore/test_namestore_api_zone_iteration.c
+++ b/src/namestore/test_namestore_api_zone_iteration.c
@@ -160,9 +160,8 @@ zone_proc (void *cls,
160 int failed = GNUNET_NO; 160 int failed = GNUNET_NO;
161 161
162 GNUNET_assert (NULL != zone); 162 GNUNET_assert (NULL != zone);
163 if (0 == memcmp (zone, 163 if (0 == GNUNET_memcmp (zone,
164 privkey, 164 privkey))
165 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
166 { 165 {
167 if (0 == strcmp (label, s_name_1)) 166 if (0 == strcmp (label, s_name_1))
168 { 167 {
@@ -207,9 +206,8 @@ zone_proc (void *cls,
207 GNUNET_break (0); 206 GNUNET_break (0);
208 } 207 }
209 } 208 }
210 else if (0 == memcmp (zone, 209 else if (0 == GNUNET_memcmp (zone,
211 privkey2, 210 privkey2))
212 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
213 { 211 {
214 if (0 == strcmp (label, s_name_3)) 212 if (0 == strcmp (label, s_name_3))
215 { 213 {
diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c
index 9df6c98cc..069c6d831 100644
--- a/src/namestore/test_namestore_api_zone_iteration_nick.c
+++ b/src/namestore/test_namestore_api_zone_iteration_nick.c
@@ -171,13 +171,13 @@ zone_proc (void *cls,
171 int failed = GNUNET_NO; 171 int failed = GNUNET_NO;
172 172
173 GNUNET_assert (NULL != zone); 173 GNUNET_assert (NULL != zone);
174 if (0 == memcmp (zone, privkey, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) 174 if (0 == GNUNET_memcmp (zone, privkey))
175 { 175 {
176 failed = check_zone_1 (label, rd_count, rd); 176 failed = check_zone_1 (label, rd_count, rd);
177 if (GNUNET_YES == failed) 177 if (GNUNET_YES == failed)
178 GNUNET_break (0); 178 GNUNET_break (0);
179 } 179 }
180 else if (0 == memcmp (zone, privkey2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) 180 else if (0 == GNUNET_memcmp (zone, privkey2))
181 { 181 {
182 failed = check_zone_2 (label, rd_count, rd); 182 failed = check_zone_2 (label, rd_count, rd);
183 if (GNUNET_YES == failed) 183 if (GNUNET_YES == failed)
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
index cbcd94cd5..e3c6d698a 100644
--- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
+++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
@@ -142,9 +142,8 @@ zone_proc (void *cls,
142 int failed = GNUNET_NO; 142 int failed = GNUNET_NO;
143 143
144 GNUNET_assert (NULL != zone); 144 GNUNET_assert (NULL != zone);
145 if (0 == memcmp (zone, 145 if (0 == GNUNET_memcmp (zone,
146 privkey, 146 privkey))
147 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
148 { 147 {
149 if (0 == strcmp (label, s_name_1)) 148 if (0 == strcmp (label, s_name_1))
150 { 149 {
@@ -189,7 +188,7 @@ zone_proc (void *cls,
189 GNUNET_break (0); 188 GNUNET_break (0);
190 } 189 }
191 } 190 }
192 else if (0 == memcmp (zone, privkey2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) 191 else if (0 == GNUNET_memcmp (zone, privkey2))
193 { 192 {
194 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 193 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
195 "Received data for not requested zone\n"); 194 "Received data for not requested zone\n");
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c
index 38da3136c..28f424b23 100644
--- a/src/namestore/test_namestore_api_zone_iteration_stop.c
+++ b/src/namestore/test_namestore_api_zone_iteration_stop.c
@@ -130,7 +130,7 @@ zone_proc (void *cls,
130 int failed = GNUNET_NO; 130 int failed = GNUNET_NO;
131 131
132 GNUNET_assert (NULL != zone); 132 GNUNET_assert (NULL != zone);
133 if (0 == memcmp (zone, privkey, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) 133 if (0 == GNUNET_memcmp (zone, privkey))
134 { 134 {
135 if (0 == strcmp (label, s_name_1)) 135 if (0 == strcmp (label, s_name_1))
136 { 136 {
@@ -174,7 +174,7 @@ zone_proc (void *cls,
174 GNUNET_break (0); 174 GNUNET_break (0);
175 } 175 }
176 } 176 }
177 else if (0 == memcmp (zone, privkey2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) 177 else if (0 == GNUNET_memcmp (zone, privkey2))
178 { 178 {
179 if (0 == strcmp (label, s_name_3)) 179 if (0 == strcmp (label, s_name_3))
180 { 180 {
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c
index 5d6444145..cb580572e 100644
--- a/src/namestore/test_namestore_api_zone_to_name.c
+++ b/src/namestore/test_namestore_api_zone_to_name.c
@@ -132,9 +132,8 @@ zone_to_name_proc (void *cls,
132 GNUNET_break (0); 132 GNUNET_break (0);
133 } 133 }
134 if ( (NULL == zone_key) || 134 if ( (NULL == zone_key) ||
135 (0 != memcmp (zone_key, 135 (0 != GNUNET_memcmp (zone_key,
136 privkey, 136 privkey)))
137 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))))
138 { 137 {
139 fail = GNUNET_YES; 138 fail = GNUNET_YES;
140 GNUNET_break (0); 139 GNUNET_break (0);
diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c
index 9c978749f..b81900931 100644
--- a/src/namestore/test_plugin_namestore.c
+++ b/src/namestore/test_plugin_namestore.c
@@ -120,9 +120,8 @@ test_record (void *cls,
120 (id % 241), 120 (id % 241),
121 sizeof (tzone_private_key)); 121 sizeof (tzone_private_key));
122 GNUNET_assert (0 == strcmp (label, tname)); 122 GNUNET_assert (0 == strcmp (label, tname));
123 GNUNET_assert (0 == memcmp (&tzone_private_key, 123 GNUNET_assert (0 == GNUNET_memcmp (&tzone_private_key,
124 private_key, 124 private_key));
125 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)));
126} 125}
127 126
128 127