Squelch some casting-away-constness warnings.
If we're constructing the string, assign the pointer to it to a non-const pointer variable, set the stat_tap_ui cli_string member to that variable, and then use the variable to free it when we're done. Don't cast away constness if we don't have to. Change-Id: If3b24dbf1c910e1e6eceb76f2f6a7ae3898315f9 Reviewed-on: https://code.wireshark.org/review/25952 Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
cb31f56204
commit
e788fac9fa
|
@ -110,17 +110,19 @@ flow_register(const void *key _U_, void *value, void *userdata _U_)
|
|||
register_analysis_t* analysis = (register_analysis_t*)value;
|
||||
stat_tap_ui flow_ui;
|
||||
GString *cmd_str = g_string_new(STR_FLOW);
|
||||
gchar *cli_string;
|
||||
|
||||
g_string_append(cmd_str, sequence_analysis_get_name(analysis));
|
||||
cli_string = g_string_free(cmd_str, FALSE);
|
||||
|
||||
flow_ui.group = REGISTER_STAT_GROUP_GENERIC;
|
||||
flow_ui.title = NULL; /* construct this from the protocol info? */
|
||||
flow_ui.cli_string = g_string_free(cmd_str, FALSE);
|
||||
flow_ui.cli_string = cli_string;
|
||||
flow_ui.tap_init_cb = flow_init;
|
||||
flow_ui.nparams = 0;
|
||||
flow_ui.params = NULL;
|
||||
register_stat_tap_ui(&flow_ui, analysis);
|
||||
g_free((char*)flow_ui.cli_string);
|
||||
g_free(cli_string);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -486,15 +486,17 @@ follow_register(const void *key _U_, void *value, void *userdata _U_)
|
|||
{
|
||||
register_follow_t *follower = (register_follow_t*)value;
|
||||
stat_tap_ui follow_ui;
|
||||
gchar *cli_string;
|
||||
|
||||
cli_string = follow_get_stat_tap_string(follower);
|
||||
follow_ui.group = REGISTER_STAT_GROUP_GENERIC;
|
||||
follow_ui.title = NULL; /* construct this from the protocol info? */
|
||||
follow_ui.cli_string = follow_get_stat_tap_string(follower);
|
||||
follow_ui.cli_string = cli_string;
|
||||
follow_ui.tap_init_cb = follow_stream;
|
||||
follow_ui.nparams = 0;
|
||||
follow_ui.params = NULL;
|
||||
register_stat_tap_ui(&follow_ui, follower);
|
||||
g_free((char*)follow_ui.cli_string);
|
||||
g_free(cli_string);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -133,15 +133,17 @@ register_rtd_tables(const void *key _U_, void *value, void *userdata _U_)
|
|||
{
|
||||
register_rtd_t *rtd = (register_rtd_t*)value;
|
||||
stat_tap_ui ui_info;
|
||||
gchar *cli_string;
|
||||
|
||||
cli_string = rtd_table_get_tap_string(rtd);
|
||||
ui_info.group = REGISTER_STAT_GROUP_RESPONSE_TIME;
|
||||
ui_info.title = NULL; /* construct this from the protocol info? */
|
||||
ui_info.cli_string = rtd_table_get_tap_string(rtd);
|
||||
ui_info.cli_string = cli_string;
|
||||
ui_info.tap_init_cb = dissector_rtd_init;
|
||||
ui_info.nparams = 0;
|
||||
ui_info.params = NULL;
|
||||
register_stat_tap_ui(&ui_info, rtd);
|
||||
g_free((char*)ui_info.cli_string);
|
||||
g_free(cli_string);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ register_simple_stat_tables(const void *key, void *value, void *userdata _U_)
|
|||
|
||||
ui_info.group = stat_tap->group;
|
||||
ui_info.title = stat_tap->title; /* construct this from the protocol info? */
|
||||
ui_info.cli_string = (char*)key;
|
||||
ui_info.cli_string = (const char *)key;
|
||||
ui_info.tap_init_cb = simple_stat_init;
|
||||
ui_info.nparams = stat_tap->nparams;
|
||||
ui_info.params = stat_tap->params;
|
||||
|
|
|
@ -154,20 +154,22 @@ register_srt_tables(const void *key _U_, void *value, void *userdata _U_)
|
|||
register_srt_t *srt = (register_srt_t*)value;
|
||||
const char* short_name = proto_get_protocol_short_name(find_protocol_by_id(get_srt_proto_id(srt)));
|
||||
stat_tap_ui ui_info;
|
||||
gchar *cli_string;
|
||||
|
||||
/* XXX - CAMEL dissector hasn't been converted over due seemingly different tap packet
|
||||
handling functions. So let the existing TShark CAMEL tap keep its registration */
|
||||
if (strcmp(short_name, "CAMEL") == 0)
|
||||
return FALSE;
|
||||
|
||||
cli_string = srt_table_get_tap_string(srt);
|
||||
ui_info.group = REGISTER_STAT_GROUP_RESPONSE_TIME;
|
||||
ui_info.title = NULL; /* construct this from the protocol info? */
|
||||
ui_info.cli_string = srt_table_get_tap_string(srt);
|
||||
ui_info.cli_string = cli_string;
|
||||
ui_info.tap_init_cb = dissector_srt_init;
|
||||
ui_info.nparams = 0;
|
||||
ui_info.params = NULL;
|
||||
register_stat_tap_ui(&ui_info, srt);
|
||||
g_free((char*)ui_info.cli_string);
|
||||
g_free(cli_string);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue