diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2021-01-29 18:34:47 +0100 |
---|---|---|
committer | AndersBroman <a.broman58@gmail.com> | 2021-01-31 10:36:22 +0000 |
commit | f21f1c292a804ec0bab56e419261c51d6abd3254 (patch) | |
tree | 3458382325adba03d67a40fcd4d311c82dfcc364 /epan/dissectors/packet-dhcp.c | |
parent | 8963dff5189f8656cae35c6abb516177a907cb9c (diff) |
dhcp: create the statistics table only once
Use the new stat_tap_find_table function during init to check if our
statistics table already exists.
Diffstat (limited to 'epan/dissectors/packet-dhcp.c')
-rw-r--r-- | epan/dissectors/packet-dhcp.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/epan/dissectors/packet-dhcp.c b/epan/dissectors/packet-dhcp.c index 4a7b5b1883..7467194d3e 100644 --- a/epan/dissectors/packet-dhcp.c +++ b/epan/dissectors/packet-dhcp.c @@ -7256,12 +7256,17 @@ static stat_tap_table_item dhcp_stat_fields[] = {{TABLE_ITEM_STRING, TAP_ALIGN_L static void dhcp_stat_init(stat_tap_table_ui* new_stat) { + const char *table_name = "DHCP Statistics"; int num_fields = sizeof(dhcp_stat_fields)/sizeof(stat_tap_table_item); - stat_tap_table* table = stat_tap_init_table("DHCP Statistics", num_fields, 0, NULL); + stat_tap_table *table; int i = 0; stat_tap_table_item_type items[sizeof(dhcp_stat_fields)/sizeof(stat_tap_table_item)]; - stat_tap_add_table(new_stat, table); + table = stat_tap_find_table(new_stat, table_name); + if (!table) { + table = stat_tap_init_table(table_name, num_fields, 0, NULL); + stat_tap_add_table(new_stat, table); + } /* Add a row for each value type */ while (opt53_text[i].strptr) |