From eb62118a1defb01f9633a8d15a342023b9246732 Mon Sep 17 00:00:00 2001 From: Matthias Wachs Date: Tue, 19 Jun 2012 08:02:12 +0000 Subject: [PATCH] - cleanup --- src/ats/test_ats_api_scheduling.c | 32 ++++++++-------- .../test_ats_api_scheduling_destroy_address.c | 38 +++++++++---------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/ats/test_ats_api_scheduling.c b/src/ats/test_ats_api_scheduling.c index 6a8e53395..39d53ddd4 100644 --- a/src/ats/test_ats_api_scheduling.c +++ b/src/ats/test_ats_api_scheduling.c @@ -67,7 +67,7 @@ struct PeerContext struct Address *addr; }; -struct Address addr[2]; +struct Address test_addr[2]; struct PeerContext p[2]; struct GNUNET_ATS_Information atsi[2]; @@ -127,12 +127,12 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, GNUNET_assert (0 == memcmp (&address->peer, &p[0].id, sizeof (struct GNUNET_PeerIdentity))); - GNUNET_assert (0 == strcmp (address->transport_name, addr[0].plugin)); - GNUNET_assert (address->address_length == addr[0].addr_len); + GNUNET_assert (0 == strcmp (address->transport_name, test_addr[0].plugin)); + GNUNET_assert (address->address_length == test_addr[0].addr_len); GNUNET_assert (0 == - memcmp (address->address, addr[0].plugin, + memcmp (address->address, test_addr[0].plugin, address->address_length)); - GNUNET_assert (addr[0].session == session); + GNUNET_assert (test_addr[0].session == session); ret = 0; @@ -179,26 +179,26 @@ check (void *cls, char *const *args, const char *cfgfile, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created peer `%s'\n", GNUNET_i2s (&p[1].id)); - addr[0].plugin = "test"; - addr[0].session = NULL; - addr[0].addr = GNUNET_strdup ("test"); - addr[0].addr_len = 4; + test_addr[0].plugin = "test"; + test_addr[0].session = NULL; + test_addr[0].addr = GNUNET_strdup ("test"); + test_addr[0].addr_len = 4; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing address creation\n"); address0.peer = p[0].id; - address0.transport_name = addr[0].plugin; - address0.address = addr[0].addr; - address0.address_length = addr[0].addr_len; - GNUNET_ATS_address_add (ats, &address0, addr[0].session, NULL, 0); - GNUNET_ATS_address_update (ats, &address0, addr[0].session, NULL, 0); + address0.transport_name = test_addr[0].plugin; + address0.address = test_addr[0].addr; + address0.address_length = test_addr[0].addr_len; + GNUNET_ATS_address_add (ats, &address0, test_addr[0].session, NULL, 0); + GNUNET_ATS_address_update (ats, &address0, test_addr[0].session, NULL, 0); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing ATS info creation\n"); atsi[0].type = htonl (GNUNET_ATS_UTILIZATION_UP); atsi[0].value = htonl (1024); - GNUNET_ATS_address_update (ats, &address0, addr[0].session, atsi, 1); + GNUNET_ATS_address_update (ats, &address0, test_addr[0].session, atsi, 1); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Testing ATS info update\n"); @@ -208,7 +208,7 @@ check (void *cls, char *const *args, const char *cfgfile, atsi[1].type = htonl (GNUNET_ATS_UTILIZATION_DOWN); atsi[1].value = htonl (1024); - GNUNET_ATS_address_update (ats, &address0, addr[0].session, atsi, 2); + GNUNET_ATS_address_update (ats, &address0, test_addr[0].session, atsi, 2); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Requesting peer `%s'\n", GNUNET_i2s (&p[0].id)); diff --git a/src/ats/test_ats_api_scheduling_destroy_address.c b/src/ats/test_ats_api_scheduling_destroy_address.c index ae2b4727d..9cf6217f8 100644 --- a/src/ats/test_ats_api_scheduling_destroy_address.c +++ b/src/ats/test_ats_api_scheduling_destroy_address.c @@ -62,10 +62,10 @@ struct PeerContext struct Address *addr; }; -struct Address addr; +struct Address test_addr; struct PeerContext p; struct GNUNET_ATS_Information atsi; -struct GNUNET_HELLO_Address address0; +struct GNUNET_HELLO_Address hello_address; static void stop_arm () @@ -130,25 +130,25 @@ address_suggest_cb (void *cls, const struct GNUNET_HELLO_Address *address, GNUNET_assert (0 == memcmp (&address->peer, &p.id, sizeof (struct GNUNET_PeerIdentity))); - GNUNET_assert (0 == strcmp (address->transport_name, addr.plugin)); - GNUNET_assert (address->address_length == addr.addr_len); + GNUNET_assert (0 == strcmp (address->transport_name, test_addr.plugin)); + GNUNET_assert (address->address_length == test_addr.addr_len); GNUNET_assert (0 == - memcmp (address->address, addr.plugin, + memcmp (address->address, test_addr.plugin, address->address_length)); - GNUNET_assert (addr.session == session); + GNUNET_assert (test_addr.session == session); if (0 == stage) { /* Delete session */ - GNUNET_ATS_address_destroyed (ats, &address0, addr.session); - addr.session = NULL; + GNUNET_ATS_address_destroyed (ats, &hello_address, test_addr.session); + test_addr.session = NULL; GNUNET_ATS_suggest_address (ats, &p.id); } if (1 == stage) { /* Delete address */ - GNUNET_ATS_address_destroyed (ats, &address0, addr.session); - addr.session = NULL; + GNUNET_ATS_address_destroyed (ats, &hello_address, test_addr.session); + test_addr.session = NULL; GNUNET_ATS_suggest_address (ats, &p.id); GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &end, NULL); } @@ -188,17 +188,17 @@ check (void *cls, char *const *args, const char *cfgfile, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created peer `%s'\n", GNUNET_i2s (&p.id)); - addr.plugin = "test"; - addr.session = &addr; - addr.addr = GNUNET_strdup ("test"); - addr.addr_len = 4; + test_addr.plugin = "test"; + test_addr.session = &test_addr; + test_addr.addr = GNUNET_strdup ("test"); + test_addr.addr_len = 4; /* Adding address with session */ - address0.peer = p.id; - address0.transport_name = addr.plugin; - address0.address = addr.addr; - address0.address_length = addr.addr_len; - GNUNET_ATS_address_add (ats, &address0, addr.session, NULL, 0); + hello_address.peer = p.id; + hello_address.transport_name = test_addr.plugin; + hello_address.address = test_addr.addr; + hello_address.address_length = test_addr.addr_len; + GNUNET_ATS_address_add (ats, &hello_address, test_addr.session, NULL, 0); GNUNET_ATS_suggest_address (ats, &p.id); } -- 2.25.1