ansi_a: dtap statistics: create the table only once

Use the new stat_tap_find_table function during init to check if our
statistics table already exists.
This commit is contained in:
Martin Kaiser 2021-01-29 18:29:46 +01:00 committed by AndersBroman
parent 46389187ca
commit 8963dff518
1 changed files with 7 additions and 2 deletions

View File

@ -10575,12 +10575,17 @@ static stat_tap_table_item dtap_stat_fields[] = {{TABLE_ITEM_UINT, TAP_ALIGN_RIG
static void ansi_a_dtap_stat_init(stat_tap_table_ui* new_stat)
{
const char *table_name = "ANSI A-I/F DTAP Statistics";
int num_fields = sizeof(dtap_stat_fields)/sizeof(stat_tap_table_item);
stat_tap_table* table = stat_tap_init_table("ANSI A-I/F DTAP Statistics", num_fields, 0, NULL);
stat_tap_table *table;
int i = 0;
stat_tap_table_item_type items[sizeof(dtap_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 fow for each value type */
while (ansi_a_dtap_strings[i].strptr)