Fix IPv6/IPX statistics generation

Use a doubly-linked list and iterate on the reversed statistics list to always test the bigger strings first

Bug: 10813
Change-Id: Ibfedac9648db58e6dadc2334eec678e26daca906
Reviewed-on: https://code.wireshark.org/review/6140
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Pascal Quantin 2014-12-30 16:23:07 +01:00 committed by Michael Mann
parent 935c8bf87b
commit bc7a9e55fd
1 changed files with 6 additions and 6 deletions

View File

@ -40,7 +40,7 @@ typedef struct _stat_cmd_arg {
void* userdata;
} stat_cmd_arg;
static GSList *stat_cmd_arg_list=NULL;
static GList *stat_cmd_arg_list=NULL;
/* structure to keep track of what stats have been specified on the
command line.
@ -70,7 +70,7 @@ register_stat_tap_ui(stat_tap_ui *ui, void *userdata)
newsca->cmd=ui->cli_string;
newsca->func=ui->tap_init_cb;
newsca->userdata=userdata;
stat_cmd_arg_list=g_slist_insert_sorted(stat_cmd_arg_list, newsca, sort_by_name);
stat_cmd_arg_list=g_list_insert_sorted(stat_cmd_arg_list, newsca, sort_by_name);
}
/* **********************************************************************
@ -79,11 +79,11 @@ register_stat_tap_ui(stat_tap_ui *ui, void *userdata)
gboolean
process_stat_cmd_arg(char *optstr)
{
GSList *entry;
GList *entry;
stat_cmd_arg *sca;
stat_requested *tr;
for(entry=stat_cmd_arg_list;entry;entry=g_slist_next(entry)){
for(entry=g_list_last(stat_cmd_arg_list);entry;entry=g_list_previous(entry)){
sca=(stat_cmd_arg *)entry->data;
if(!strncmp(sca->cmd,optstr,strlen(sca->cmd))){
tr=(stat_requested *)g_malloc(sizeof (stat_requested));
@ -102,10 +102,10 @@ process_stat_cmd_arg(char *optstr)
void
list_stat_cmd_args(void)
{
GSList *entry;
GList *entry;
stat_cmd_arg *sca;
for(entry=stat_cmd_arg_list;entry;entry=g_slist_next(entry)){
for(entry=stat_cmd_arg_list;entry;entry=g_list_next(entry)){
sca=(stat_cmd_arg *)entry->data;
fprintf(stderr," %s\n",sca->cmd);
}