aboutsummaryrefslogtreecommitdiff
path: root/src/ats
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/ats
parenta097690795f4f814de7cdbc97ef95fb899eeacd3 (diff)
downloadgnunet-f5f5a9f680df2cebe6435ec87650cb3cb6e3ef6e.tar.gz
gnunet-f5f5a9f680df2cebe6435ec87650cb3cb6e3ef6e.zip
memcmp() -> GNUNET_memcmp(), first take
Diffstat (limited to 'src/ats')
-rw-r--r--src/ats/ats_api_performance.c7
-rw-r--r--src/ats/ats_api_scheduling.c10
-rw-r--r--src/ats/gnunet-ats-solver-eval.c2
-rw-r--r--src/ats/gnunet-service-ats-new.c5
-rw-r--r--src/ats/gnunet-service-ats_addresses.c4
-rw-r--r--src/ats/gnunet-service-ats_normalization.c5
-rw-r--r--src/ats/plugin_ats2_simple.c5
-rw-r--r--src/ats/plugin_ats_mlp.c4
-rw-r--r--src/ats/plugin_ats_ril.c2
-rw-r--r--src/ats/test_ats_lib.c5
10 files changed, 20 insertions, 29 deletions
diff --git a/src/ats/ats_api_performance.c b/src/ats/ats_api_performance.c
index 12dec776e..0954c02d5 100644
--- a/src/ats/ats_api_performance.c
+++ b/src/ats/ats_api_performance.c
@@ -383,9 +383,8 @@ handle_reservation_result (void *cls,
383 383
384 amount = ntohl (rr->amount); 384 amount = ntohl (rr->amount);
385 rc = ph->reservation_head; 385 rc = ph->reservation_head;
386 if (0 != memcmp (&rr->peer, 386 if (0 != GNUNET_memcmp (&rr->peer,
387 &rc->peer, 387 &rc->peer))
388 sizeof(struct GNUNET_PeerIdentity)))
389 { 388 {
390 GNUNET_break(0); 389 GNUNET_break(0);
391 reconnect (ph); 390 reconnect (ph);
@@ -498,7 +497,7 @@ handle_address_list (void *cls,
498 return; /* was canceled */ 497 return; /* was canceled */
499 498
500 memset (&allzeros, '\0', sizeof (allzeros)); 499 memset (&allzeros, '\0', sizeof (allzeros));
501 if ( (0 == memcmp (&allzeros, &pi->peer, sizeof(allzeros))) && 500 if ( (0 == GNUNET_is_zero (&pi->peer)) &&
502 (0 == plugin_name_length) && 501 (0 == plugin_name_length) &&
503 (0 == plugin_address_length) ) 502 (0 == plugin_address_length) )
504 { 503 {
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c
index 3c8ad9b9a..532426e91 100644
--- a/src/ats/ats_api_scheduling.c
+++ b/src/ats/ats_api_scheduling.c
@@ -230,9 +230,8 @@ find_session (struct GNUNET_ATS_SchedulingHandle *sh,
230 as we communicate asynchronously with the ATS service. */ 230 as we communicate asynchronously with the ATS service. */
231 return NULL; 231 return NULL;
232 } 232 }
233 if (0 != memcmp (peer, 233 if (0 != GNUNET_memcmp (peer,
234 &ar->address->peer, 234 &ar->address->peer))
235 sizeof (struct GNUNET_PeerIdentity)))
236 { 235 {
237 GNUNET_break (0); 236 GNUNET_break (0);
238 return NULL; 237 return NULL;
@@ -298,9 +297,8 @@ find_session_id (struct GNUNET_ATS_SchedulingHandle *sh,
298 (GNUNET_NO == sh->session_array[i]->in_destroy) && 297 (GNUNET_NO == sh->session_array[i]->in_destroy) &&
299 ( (session == sh->session_array[i]->session) || 298 ( (session == sh->session_array[i]->session) ||
300 (NULL == sh->session_array[i]->session) ) && 299 (NULL == sh->session_array[i]->session) ) &&
301 (0 == memcmp (&address->peer, 300 (0 == GNUNET_memcmp (&address->peer,
302 &sh->session_array[i]->address->peer, 301 &sh->session_array[i]->address->peer)) &&
303 sizeof (struct GNUNET_PeerIdentity))) &&
304 (0 == GNUNET_HELLO_address_cmp (address, 302 (0 == GNUNET_HELLO_address_cmp (address,
305 sh->session_array[i]->address)) ) 303 sh->session_array[i]->address)) )
306 return i; 304 return i;
diff --git a/src/ats/gnunet-ats-solver-eval.c b/src/ats/gnunet-ats-solver-eval.c
index 62e09533f..833cb9ded 100644
--- a/src/ats/gnunet-ats-solver-eval.c
+++ b/src/ats/gnunet-ats-solver-eval.c
@@ -122,7 +122,7 @@ find_peer_by_pid (const struct GNUNET_PeerIdentity *pid)
122{ 122{
123 struct TestPeer *cur; 123 struct TestPeer *cur;
124 for (cur = peer_head; NULL != cur; cur = cur->next) 124 for (cur = peer_head; NULL != cur; cur = cur->next)
125 if (0 == memcmp (&cur->peer_id, pid, sizeof (struct GNUNET_PeerIdentity))) 125 if (0 == GNUNET_memcmp (&cur->peer_id, pid))
126 return cur; 126 return cur;
127 return NULL; 127 return NULL;
128} 128}
diff --git a/src/ats/gnunet-service-ats-new.c b/src/ats/gnunet-service-ats-new.c
index f2bc1de7f..b451c8c67 100644
--- a/src/ats/gnunet-service-ats-new.c
+++ b/src/ats/gnunet-service-ats-new.c
@@ -362,9 +362,8 @@ handle_suggest_cancel (void *cls,
362 cp = cp->next) 362 cp = cp->next)
363 if ( (cp->pref.pk == (enum GNUNET_MQ_PreferenceKind) ntohl (msg->pk)) && 363 if ( (cp->pref.pk == (enum GNUNET_MQ_PreferenceKind) ntohl (msg->pk)) &&
364 (cp->pref.bw.value__ == msg->bw.value__) && 364 (cp->pref.bw.value__ == msg->bw.value__) &&
365 (0 == memcmp (&cp->pref.peer, 365 (0 == GNUNET_memcmp (&cp->pref.peer,
366 &msg->peer, 366 &msg->peer)) )
367 sizeof (struct GNUNET_PeerIdentity))) )
368 break; 367 break;
369 if (NULL == cp) 368 if (NULL == cp)
370 { 369 {
diff --git a/src/ats/gnunet-service-ats_addresses.c b/src/ats/gnunet-service-ats_addresses.c
index dd5cee96f..efe968024 100644
--- a/src/ats/gnunet-service-ats_addresses.c
+++ b/src/ats/gnunet-service-ats_addresses.c
@@ -682,9 +682,7 @@ GAS_handle_request_address_list (struct GNUNET_SERVICE_Client *client,
682 memset (&allzeros, 682 memset (&allzeros,
683 '\0', 683 '\0',
684 sizeof (struct GNUNET_PeerIdentity)); 684 sizeof (struct GNUNET_PeerIdentity));
685 if (0 == memcmp (&alrm->peer, 685 if (0 == GNUNET_is_zero (&alrm->peer))
686 &allzeros,
687 sizeof (struct GNUNET_PeerIdentity)))
688 { 686 {
689 /* Return addresses for all peers */ 687 /* Return addresses for all peers */
690 GAS_addresses_get_peer_info (NULL, 688 GAS_addresses_get_peer_info (NULL,
diff --git a/src/ats/gnunet-service-ats_normalization.c b/src/ats/gnunet-service-ats_normalization.c
index f68e6ec11..4b58bf9b7 100644
--- a/src/ats/gnunet-service-ats_normalization.c
+++ b/src/ats/gnunet-service-ats_normalization.c
@@ -250,9 +250,8 @@ GAS_normalization_update_property (struct ATS_Address *address)
250 GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses, 250 GNUNET_CONTAINER_multipeermap_iterate (GSA_addresses,
251 &find_min_max_it, 251 &find_min_max_it,
252 &range); 252 &range);
253 if (0 != memcmp (&range, 253 if (0 != GNUNET_memcmp (&range,
254 &property_range, 254 &property_range))
255 sizeof (struct PropertyRange)))
256 { 255 {
257 /* limits changed, (re)normalize all addresses */ 256 /* limits changed, (re)normalize all addresses */
258 property_range = range; 257 property_range = range;
diff --git a/src/ats/plugin_ats2_simple.c b/src/ats/plugin_ats2_simple.c
index 449b50fb7..35a256f32 100644
--- a/src/ats/plugin_ats2_simple.c
+++ b/src/ats/plugin_ats2_simple.c
@@ -492,9 +492,8 @@ watch_cb (void *cls,
492 struct GNUNET_TIME_Absolute expiration; 492 struct GNUNET_TIME_Absolute expiration;
493 struct Hello *hello; 493 struct Hello *hello;
494 494
495 if (0 != memcmp (&p->pid, 495 if (0 != GNUNET_memcmp (&p->pid,
496 &record->peer, 496 &record->peer))
497 sizeof (struct GNUNET_PeerIdentity)))
498 { 497 {
499 GNUNET_break (0); 498 GNUNET_break (0);
500 return; 499 return;
diff --git a/src/ats/plugin_ats_mlp.c b/src/ats/plugin_ats_mlp.c
index 8e7880793..0f3a727a7 100644
--- a/src/ats/plugin_ats_mlp.c
+++ b/src/ats/plugin_ats_mlp.c
@@ -1401,7 +1401,7 @@ mlp_propagate_results (void *cls,
1401 mlpi->b_in = mlp_bw_in; 1401 mlpi->b_in = mlp_bw_in;
1402 address->assigned_bw_out = mlp_bw_out; 1402 address->assigned_bw_out = mlp_bw_out;
1403 mlpi->b_out = mlp_bw_out; 1403 mlpi->b_out = mlp_bw_out;
1404 if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer)))) 1404 if ((NULL == mlp->exclude_peer) || (0 != GNUNET_memcmp (&address->peer, mlp->exclude_peer)))
1405 mlp->env->bandwidth_changed_cb (mlp->env->cls, address); 1405 mlp->env->bandwidth_changed_cb (mlp->env->cls, address);
1406 return GNUNET_OK; 1406 return GNUNET_OK;
1407 } 1407 }
@@ -1417,7 +1417,7 @@ mlp_propagate_results (void *cls,
1417 mlpi->b_in = mlp_bw_in; 1417 mlpi->b_in = mlp_bw_in;
1418 address->assigned_bw_out = mlp_bw_out; 1418 address->assigned_bw_out = mlp_bw_out;
1419 mlpi->b_out = mlp_bw_out; 1419 mlpi->b_out = mlp_bw_out;
1420 if ((NULL == mlp->exclude_peer) || (0 != memcmp (&address->peer, mlp->exclude_peer, sizeof (address->peer)))) 1420 if ((NULL == mlp->exclude_peer) || (0 != GNUNET_memcmp (&address->peer, mlp->exclude_peer)))
1421 mlp->env->bandwidth_changed_cb (mlp->env->cls, address); 1421 mlp->env->bandwidth_changed_cb (mlp->env->cls, address);
1422 return GNUNET_OK; 1422 return GNUNET_OK;
1423 } 1423 }
diff --git a/src/ats/plugin_ats_ril.c b/src/ats/plugin_ats_ril.c
index 6e55f3a1c..9f78450c2 100644
--- a/src/ats/plugin_ats_ril.c
+++ b/src/ats/plugin_ats_ril.c
@@ -2016,7 +2016,7 @@ ril_get_agent (struct GAS_RIL_Handle *solver, const struct GNUNET_PeerIdentity *
2016 2016
2017 for (cur = solver->agents_head; NULL != cur; cur = cur->next) 2017 for (cur = solver->agents_head; NULL != cur; cur = cur->next)
2018 { 2018 {
2019 if (0 == memcmp (peer, &cur->peer, sizeof(struct GNUNET_PeerIdentity))) 2019 if (0 == GNUNET_memcmp (peer, &cur->peer))
2020 { 2020 {
2021 return cur; 2021 return cur;
2022 } 2022 }
diff --git a/src/ats/test_ats_lib.c b/src/ats/test_ats_lib.c
index 21eca18e9..33597e678 100644
--- a/src/ats/test_ats_lib.c
+++ b/src/ats/test_ats_lib.c
@@ -540,9 +540,8 @@ reservation_cb (void *cls,
540 cmd->details.reserve_bandwidth.rc = NULL; 540 cmd->details.reserve_bandwidth.rc = NULL;
541 make_peer (cmd->details.reserve_bandwidth.pid, 541 make_peer (cmd->details.reserve_bandwidth.pid,
542 &pid); 542 &pid);
543 GNUNET_assert (0 == memcmp (peer, 543 GNUNET_assert (0 == GNUNET_memcmp (peer,
544 &pid, 544 &pid));
545 sizeof (struct GNUNET_PeerIdentity)));
546 switch (cmd->details.reserve_bandwidth.expected_result) 545 switch (cmd->details.reserve_bandwidth.expected_result)
547 { 546 {
548 case GNUNET_OK: 547 case GNUNET_OK: