diff options
author | AndersBroman <anders.broman@ericsson.com> | 2016-09-28 13:31:14 +0200 |
---|---|---|
committer | Anders Broman <a.broman58@gmail.com> | 2016-09-28 13:43:40 +0000 |
commit | c3b25e8111dc304486537d7cc60e54ba27c04fa0 (patch) | |
tree | b8284df0f843ac05441373d60e027d94d3af1d09 /caputils/capture-pcap-util.c | |
parent | 4f636d100e35865fc7156ffb2ba674605d1b404c (diff) | |
download | wireshark-c3b25e8111dc304486537d7cc60e54ba27c04fa0.tar.gz |
Use g_slist_prepend, it should be faster if there's a lot of IP addresses
Change-Id: I3861c0af24523315db6889b22ec93159174ba86f
Reviewed-on: https://code.wireshark.org/review/17966
Petri-Dish: Anders Broman <a.broman58@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'caputils/capture-pcap-util.c')
-rw-r--r-- | caputils/capture-pcap-util.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/caputils/capture-pcap-util.c b/caputils/capture-pcap-util.c index c014f83872..a41b7668d5 100644 --- a/caputils/capture-pcap-util.c +++ b/caputils/capture-pcap-util.c @@ -423,7 +423,7 @@ if_info_add_address(if_info_t *if_info, struct sockaddr *addr) if_addr->ifat_type = IF_AT_IPv4; if_addr->addr.ip4_addr = *((guint32 *)&(ai->sin_addr.s_addr)); - if_info->addrs = g_slist_append(if_info->addrs, if_addr); + if_info->addrs = g_slist_prepend(if_info->addrs, if_addr); break; case AF_INET6: @@ -433,7 +433,7 @@ if_info_add_address(if_info_t *if_info, struct sockaddr *addr) memcpy((void *)&if_addr->addr.ip6_addr, (void *)&ai6->sin6_addr.s6_addr, sizeof if_addr->addr.ip6_addr); - if_info->addrs = g_slist_append(if_info->addrs, if_addr); + if_info->addrs = g_slist_prepend(if_info->addrs, if_addr); break; } } @@ -452,6 +452,10 @@ if_info_ip(if_info_t *if_info, pcap_if_t *d) if (a->addr != NULL) if_info_add_address(if_info, a->addr); } + + if(if_info->addrs){ + if_info->addrs = g_slist_reverse(if_info->addrs); + } } #ifdef HAVE_PCAP_REMOTE |