X-Git-Url: http://sjero.net/git/?p=iperf;a=blobdiff_plain;f=src%2FList.cpp;h=4b850a6dcbf38c2befcd5997b44af1af7f3c6999;hp=8cba006dcd9c0ee7016439d70d17b3d223a0f6ed;hb=a5a03e6ab0fdf9c4d7d4c085fcf01436f9ba3202;hpb=90fc1e2c0c74319759b21d4a177c32691b88fdf3 diff --git a/src/List.cpp b/src/List.cpp index 8cba006..4b850a6 100644 --- a/src/List.cpp +++ b/src/List.cpp @@ -71,7 +71,8 @@ void Iperf_pushback ( Iperf_ListEntry *add, Iperf_ListEntry **root ) { /* * Delete Entry del from the List */ -void Iperf_delete ( iperf_sockaddr *del, Iperf_ListEntry **root ) { +void Iperf_delete (struct sockaddr_storage *del, Iperf_ListEntry **root) +{ Iperf_ListEntry *temp = Iperf_present( del, *root ); if ( temp != NULL ) { if ( temp == *root ) { @@ -106,14 +107,13 @@ void Iperf_destroy ( Iperf_ListEntry **root ) { /* * Check if the exact Entry find is present */ -Iperf_ListEntry* Iperf_present ( iperf_sockaddr *find, Iperf_ListEntry *root ) { - Iperf_ListEntry *itr = root; - while ( itr != NULL ) { - if ( SockAddr_are_Equal( (sockaddr*)itr, (sockaddr*)find ) ) { +Iperf_ListEntry* Iperf_present(struct sockaddr_storage *find, Iperf_ListEntry *root) +{ + Iperf_ListEntry *itr; + + for (itr = root; itr != NULL; itr = itr->next) + if (SockAddr_are_Equal(find, &itr->data)) return itr; - } - itr = itr->next; - } return NULL; } @@ -121,14 +121,9 @@ Iperf_ListEntry* Iperf_present ( iperf_sockaddr *find, Iperf_ListEntry *root ) { * Check if a Entry find is in the List or if any * Entry exists that has the same host as the * Entry find + * FIXME: The `or' condition was not implemented */ -Iperf_ListEntry* Iperf_hostpresent ( iperf_sockaddr *find, Iperf_ListEntry *root ) { - Iperf_ListEntry *itr = root; - while ( itr != NULL ) { - if ( SockAddr_Hostare_Equal( (sockaddr*)itr, (sockaddr*)find ) ) { - return itr; - } - itr = itr->next; - } - return NULL; +Iperf_ListEntry* Iperf_hostpresent(struct sockaddr_storage *find, Iperf_ListEntry *root) +{ + return Iperf_present(find, root); }