Skip to content

Commit

Permalink
Fix IPv6/IPX statistics generation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
pquantin authored and mmann78 committed Dec 30, 2014
1 parent 935c8bf commit bc7a9e5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions epan/stat_tap_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
}

/* **********************************************************************
Expand All @@ -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));
Expand All @@ -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);
}
Expand Down

0 comments on commit bc7a9e5

Please sign in to comment.