Cleanup sourcecode.

svn path=/trunk/; revision=27059
This commit is contained in:
Jaap Keuter 2008-12-19 11:30:50 +00:00
parent ba7be20b74
commit 0c7d516955
1 changed files with 75 additions and 82 deletions

View File

@ -213,7 +213,7 @@ void graph_analysis_data_init(void){
/****************************************************************************/
/* Add a new item into the graph */
static int add_to_graph(voip_calls_tapinfo_t *tapinfo _U_, packet_info *pinfo, const gchar *frame_label, const gchar *comment, guint16 call_num, address *src_addr, address *dst_addr, guint16 line_style)
static void add_to_graph(voip_calls_tapinfo_t *tapinfo _U_, packet_info *pinfo, const gchar *frame_label, const gchar *comment, guint16 call_num, address *src_addr, address *dst_addr, guint16 line_style)
{
graph_analysis_item_t *gai;
@ -240,8 +240,6 @@ static int add_to_graph(voip_calls_tapinfo_t *tapinfo _U_, packet_info *pinfo, c
tapinfo->graph_analysis->list = g_list_append(tapinfo->graph_analysis->list, gai);
return 1;
}
/****************************************************************************/
@ -251,33 +249,32 @@ static int append_to_frame_graph(voip_calls_tapinfo_t *tapinfo _U_, guint32 fram
{
graph_analysis_item_t *gai;
GList *list;
gchar *tmp_str = NULL;
gchar *tmp_str2 = NULL;
gchar *frame_label = NULL;
gchar *comment = NULL;
list = g_list_first(tapinfo->graph_analysis->list);
while (list)
{
gai = list->data;
if (gai->frame_num == frame_num){
tmp_str = gai->frame_label;
tmp_str2 = gai->comment;
frame_label = gai->frame_label;
comment = gai->comment;
if (new_frame_label != NULL){
gai->frame_label = g_strdup_printf("%s %s", gai->frame_label, new_frame_label);
g_free(tmp_str);
gai->frame_label = g_strdup_printf("%s %s", frame_label, new_frame_label);
g_free(frame_label);
}
if (new_comment != NULL){
gai->comment = g_strdup_printf("%s %s", gai->comment, new_comment);
g_free(tmp_str2);
gai->comment = g_strdup_printf("%s %s", comment, new_comment);
g_free(comment);
}
break;
}
list = g_list_next(list);
}
if (tmp_str == NULL) return 0; /* it is not in the list */
return 1;
return list ? 1 : 0;
}
@ -288,32 +285,32 @@ static int change_frame_graph(voip_calls_tapinfo_t *tapinfo _U_, guint32 frame_n
{
graph_analysis_item_t *gai;
GList *list;
gchar *tmp_str = NULL;
gchar *tmp_str2 = NULL;
gchar *frame_label = NULL;
gchar *comment = NULL;
list = g_list_first(tapinfo->graph_analysis->list);
while (list)
{
gai = list->data;
if (gai->frame_num == frame_num){
tmp_str = gai->frame_label;
tmp_str2 = gai->comment;
frame_label = gai->frame_label;
comment = gai->comment;
if (new_frame_label != NULL){
gai->frame_label = g_strdup(new_frame_label);
g_free(tmp_str);
g_free(frame_label);
}
if (new_comment != NULL){
gai->comment = g_strdup(new_comment);
g_free(tmp_str2);
g_free(comment);
}
break;
}
list = g_list_next(list);
}
if (tmp_str == NULL) return 0; /* it is not in the list */
return 1;
return list ? 1 : 0;
}
@ -339,12 +336,9 @@ static guint change_call_num_graph(voip_calls_tapinfo_t *tapinfo _U_, guint16 ca
return items_changed;
}
/****************************************************************************/
/* Insert the item in the graph list */
void insert_to_graph(voip_calls_tapinfo_t *tapinfo _U_, packet_info *pinfo, const gchar *frame_label, gchar *comment, guint16 call_num, address *src_addr, address *dst_addr, guint16 line_style, double time, guint32 frame_num)
void insert_to_graph(voip_calls_tapinfo_t *tapinfo _U_, packet_info *pinfo, const gchar *frame_label, const gchar *comment, guint16 call_num, address *src_addr, address *dst_addr, guint16 line_style, double time, guint32 frame_num)
{
graph_analysis_item_t *gai, *new_gai;
GList *list;
@ -1941,7 +1935,6 @@ H225calls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
g_free(frame_label);
g_free(comment);
}
tapinfo->redraw = TRUE;
@ -3629,7 +3622,7 @@ VoIPcalls_packet(void *ptr _U_, packet_info *pinfo, epan_dissect_t *edt _U_, con
if (pi->call_state != VOIP_NO_STATE)
callsinfo->call_state = pi->call_state;
if (pi->call_comment) {
if (callsinfo->call_comment) g_free(callsinfo->call_comment);
g_free(callsinfo->call_comment);
callsinfo->call_comment=g_strdup(pi->call_comment);
}
callsinfo->stop_sec=(gint32)(pinfo->fd->rel_ts.secs);