Skip to content
Snippets Groups Projects
Commit 65822b7b authored by rswindell's avatar rswindell
Browse files

Minor optimization for enumerating locked linked lists.

parent b176f632
No related branches found
No related tags found
No related merge requests found
...@@ -2117,7 +2117,7 @@ int main(int argc, char** argv) ...@@ -2117,7 +2117,7 @@ int main(int argc, char** argv)
listLock(&login_attempt_list); listLock(&login_attempt_list);
count=0; count=0;
for(node=listFirstNode(&login_attempt_list); node!=NULL; node=listNextNode(node)) { for(node=login_attempt_list.first; node!=NULL; node=node->next) {
login_attempt=node->data; login_attempt=node->data;
localtime_r(&login_attempt->time,&tm); localtime_r(&login_attempt->time,&tm);
printf("%u attempts (%u duplicate) from %s, last via %s on %u/%u %02u:%02u:%02u (user: %s, password: %s)\n" printf("%u attempts (%u duplicate) from %s, last via %s on %u/%u %02u:%02u:%02u (user: %s, password: %s)\n"
...@@ -2152,7 +2152,7 @@ int main(int argc, char** argv) ...@@ -2152,7 +2152,7 @@ int main(int argc, char** argv)
listLock(&client_list); listLock(&client_list);
count=0; count=0;
for(node=listFirstNode(&client_list); node!=NULL; node=listNextNode(node)) { for(node=client_list.first; node!=NULL; node=node->next) {
client=node->data; client=node->data;
localtime_r(&client->time,&tm); localtime_r(&client->time,&tm);
printf("%04d %s %s %s %s port %u since %u/%u %02u:%02u:%02u\n" printf("%04d %s %s %s %s port %u since %u/%u %02u:%02u:%02u\n"
......
...@@ -2695,7 +2695,7 @@ static list_node_t* login_attempted(link_list_t* list, SOCKADDR_IN* addr) ...@@ -2695,7 +2695,7 @@ static list_node_t* login_attempted(link_list_t* list, SOCKADDR_IN* addr)
list_node_t* node; list_node_t* node;
login_attempt_t* attempt; login_attempt_t* attempt;
for(node=listFirstNode(list); node!=NULL; node=listNextNode(node)) { for(node=list->first; node!=NULL; node=node->next) {
attempt=node->data; attempt=node->data;
if(memcmp(&attempt->addr,&addr->sin_addr,sizeof(attempt->addr))==0) if(memcmp(&attempt->addr,&addr->sin_addr,sizeof(attempt->addr))==0)
break; break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment