mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
CLEANUP: resolvers: get rid of single-iteration loop in resolv_get_ip_from_response()
In issue 1424 Coverity reports that the loop increment is unreachable, which is true, the list_for_each_entry() was replaced with a for loop, but it was already not needed and was instead used as a convenient construct for a single iteration lookup. Let's get rid of all this now and replace the loop with an "if" statement.
This commit is contained in:
parent
0b22247606
commit
dbb0bb59e3
@ -1665,14 +1665,13 @@ int resolv_get_ip_from_response(struct resolv_response *r_res,
|
|||||||
LIST_APPEND(&found_record->attached_servers, &owner->ip_rec_item);
|
LIST_APPEND(&found_record->attached_servers, &owner->ip_rec_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (eb32 = eb32_first(&r_res->answer_tree); eb32 != NULL; eb32 = eb32_next(eb32)) {
|
eb32 = eb32_first(&r_res->answer_tree);
|
||||||
record = eb32_entry(eb32, typeof(*record), link);
|
if (eb32) {
|
||||||
/* Move the first record to the end of the list, for internal
|
/* Move the first record to the end of the list, for internal
|
||||||
* round robin.
|
* round robin.
|
||||||
*/
|
*/
|
||||||
eb32_delete(&record->link);
|
eb32_delete(eb32);
|
||||||
eb32_insert(&r_res->answer_tree, &record->link);
|
eb32_insert(&r_res->answer_tree, eb32);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (currentip_found ? RSLV_UPD_NO : RSLV_UPD_SRVIP_NOT_FOUND);
|
return (currentip_found ? RSLV_UPD_NO : RSLV_UPD_SRVIP_NOT_FOUND);
|
||||||
|
Loading…
Reference in New Issue
Block a user