From c6368b2f6fde7e19449a70f785884ae41a164dc2 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 13 Feb 2012 15:14:10 +0000 Subject: -use loop when looking up session... --- src/transport/plugin_transport_http.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'src/transport/plugin_transport_http.c') diff --git a/src/transport/plugin_transport_http.c b/src/transport/plugin_transport_http.c index 820d51ffc..e40d2c8f8 100644 --- a/src/transport/plugin_transport_http.c +++ b/src/transport/plugin_transport_http.c @@ -434,21 +434,13 @@ struct Session * lookup_session (struct Plugin *plugin, const struct GNUNET_HELLO_Address *address) { - struct Session *tmp = NULL; + struct Session *pos; - tmp = plugin->head; - if (tmp == NULL) - return NULL; - while (tmp != NULL) - { - if (0 != memcmp (&address->peer, &tmp->target, sizeof (struct GNUNET_PeerIdentity))) - continue; - if ((address->address_length != tmp->addrlen) && - (0 != memcmp (address->address, tmp->addr, tmp->addrlen))) - continue; - - return tmp; - } + for (pos = plugin->head; NULL != pos; pos = pos->next) + if ( (0 == memcmp (&address->peer, &pos->target, sizeof (struct GNUNET_PeerIdentity))) && + (address->address_length == pos->addrlen) && + (0 == memcmp (address->address, pos->addr, pos->addrlen)) ) + return pos; return NULL; } -- cgit v1.2.3