respondd: append interface infos at the head of the list
This avoids walking to the end.
This commit is contained in:
parent
2c302aa012
commit
9198ad056d
|
@ -621,13 +621,14 @@ int main(int argc, char **argv) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct interface_delay_info **pos = &if_delay_info_list;
|
// insert the interface delay info at the beginning of the list
|
||||||
// walk to the end of the list
|
struct interface_delay_info **head = &if_delay_info_list;
|
||||||
for(; *pos; pos = &((*pos)->next)) {}
|
struct interface_delay_info *old_head = if_delay_info_list;
|
||||||
*pos = malloc(sizeof(*if_delay_info_list));
|
|
||||||
(*pos)->ifindex = last_ifindex;
|
*head = malloc(sizeof(*if_delay_info_list));
|
||||||
(*pos)->max_multicast_delay = max_multicast_delay;
|
(*head)->ifindex = last_ifindex;
|
||||||
(*pos)->next = NULL;
|
(*head)->max_multicast_delay = max_multicast_delay;
|
||||||
|
(*head)->next = old_head;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue