Guard fdata->col_text_len/fdata->col_text with NEW_PACKET_LIST

svn path=/trunk/; revision=30044
This commit is contained in:
Kovarththanan Rajaratnam 2009-09-21 17:12:46 +00:00
parent d923139789
commit 9e21f0f2d8
2 changed files with 51 additions and 46 deletions

View File

@ -60,7 +60,6 @@ static gint p_compare(gconstpointer a, gconstpointer b)
}
void
p_add_proto_data(frame_data *fd, int proto, void *proto_data)
{
@ -74,8 +73,8 @@ p_add_proto_data(frame_data *fd, int proto, void *proto_data)
/* Add it to the GSLIST */
fd -> pfd = g_slist_insert_sorted(fd -> pfd,
(gpointer *)p1,
p_compare);
(gpointer *)p1,
p_compare);
}
@ -140,52 +139,52 @@ p_remove_proto_data(frame_data *fd, int proto)
gint
frame_data_compare(const frame_data *fdata1, const frame_data *fdata2, int field)
{
switch (field) {
case COL_NUMBER:
return COMPARE_FRAME_NUM();
switch (field) {
case COL_NUMBER:
return COMPARE_FRAME_NUM();
case COL_CLS_TIME:
switch (timestamp_get_type()) {
case TS_ABSOLUTE:
case TS_ABSOLUTE_WITH_DATE:
case TS_EPOCH:
return COMPARE_TS(abs_ts);
case COL_CLS_TIME:
switch (timestamp_get_type()) {
case TS_ABSOLUTE:
case TS_ABSOLUTE_WITH_DATE:
case TS_EPOCH:
return COMPARE_TS(abs_ts);
case TS_RELATIVE:
return COMPARE_TS(rel_ts);
case TS_RELATIVE:
return COMPARE_TS(rel_ts);
case TS_DELTA:
return COMPARE_TS(del_cap_ts);
case TS_DELTA:
return COMPARE_TS(del_cap_ts);
case TS_DELTA_DIS:
return COMPARE_TS(del_dis_ts);
case TS_DELTA_DIS:
return COMPARE_TS(del_dis_ts);
case TS_NOT_SET:
return 0;
}
return 0;
case TS_NOT_SET:
return 0;
}
return 0;
case COL_ABS_TIME:
case COL_ABS_DATE_TIME:
return COMPARE_TS(abs_ts);
case COL_ABS_TIME:
case COL_ABS_DATE_TIME:
return COMPARE_TS(abs_ts);
case COL_REL_TIME:
return COMPARE_TS(rel_ts);
case COL_REL_TIME:
return COMPARE_TS(rel_ts);
case COL_DELTA_TIME:
return COMPARE_TS(del_cap_ts);
case COL_DELTA_TIME:
return COMPARE_TS(del_cap_ts);
case COL_DELTA_TIME_DIS:
return COMPARE_TS(del_dis_ts);
case COL_DELTA_TIME_DIS:
return COMPARE_TS(del_dis_ts);
case COL_PACKET_LENGTH:
return COMPARE_NUM(pkt_len);
case COL_PACKET_LENGTH:
return COMPARE_NUM(pkt_len);
case COL_CUMULATIVE_BYTES:
return COMPARE_NUM(cum_bytes);
case COL_CUMULATIVE_BYTES:
return COMPARE_NUM(cum_bytes);
}
g_return_val_if_reached(0);
}
g_return_val_if_reached(0);
}
void
@ -217,6 +216,10 @@ frame_data_init(frame_data *fdata, guint32 num,
fdata->flags.marked = 0;
fdata->flags.ref_time = 0;
fdata->color_filter = NULL;
#ifdef NEW_PACKET_LIST
fdata->col_text_len = NULL;
fdata->col_text = NULL;
#endif
/* If we don't have the time stamp of the first packet in the
capture, it's because this is the first packet. Save the time
@ -240,7 +243,7 @@ frame_data_init(frame_data *fdata, guint32 num,
to it (we check for "greater than" so as not to be confused by
time moving backwards). */
if ((gint32)elapsed_time->secs < fdata->rel_ts.secs
|| ((gint32)elapsed_time->secs == fdata->rel_ts.secs && (gint32)elapsed_time->nsecs < fdata->rel_ts.nsecs)) {
|| ((gint32)elapsed_time->secs == fdata->rel_ts.secs && (gint32)elapsed_time->nsecs < fdata->rel_ts.nsecs)) {
*elapsed_time = fdata->rel_ts;
}

View File

@ -25,14 +25,14 @@
#ifndef __FRAME_DATA_H__
#define __FRAME_DATA_H__
#include "column_info.h"
#include "tvbuff.h"
#include <epan/column_info.h>
#include <epan/tvbuff.h>
#include <epan/nstime.h>
/* XXX - some of this stuff is used only while a packet is being dissected;
should we keep that stuff in the "packet_info" structure, instead, to
save memory? */
/* The frame number is the ordinal number of the frame in the capture, so
it's 1-origin. In various contexts, 0 as a frame number means "frame
number unknown". */
@ -47,11 +47,11 @@ typedef struct _frame_data {
gint64 file_off; /* File offset */
gint8 lnk_t; /* Per-packet encapsulation/data-link type */
struct {
unsigned int passed_dfilter : 1; /* 1 = display, 0 = no display */
unsigned int encoding : 2; /* Character encoding (ASCII, EBCDIC...) */
unsigned int visited : 1; /* Has this packet been visited yet? 1=Yes,0=No*/
unsigned int marked : 1; /* 1 = marked by user, 0 = normal */
unsigned int ref_time : 1; /* 1 = marked as a reference time frame, 0 = normal */
unsigned int passed_dfilter : 1; /* 1 = display, 0 = no display */
unsigned int encoding : 2; /* Character encoding (ASCII, EBCDIC...) */
unsigned int visited : 1; /* Has this packet been visited yet? 1=Yes,0=No*/
unsigned int marked : 1; /* 1 = marked by user, 0 = normal */
unsigned int ref_time : 1; /* 1 = marked as a reference time frame, 0 = normal */
} flags;
void *color_filter; /* Per-packet matching color_filter_t object */
@ -61,8 +61,10 @@ typedef struct _frame_data {
nstime_t del_dis_ts; /* Delta timestamp to previous displayed frame (yes, it can be negative) */
nstime_t del_cap_ts; /* Delta timestamp to previous captured frame (yes, it can be negative) */
#ifdef NEW_PACKET_LIST
gchar **col_text; /* The column text for some columns, see colum_utils */
guint *col_text_len; /* The length of the column text strings in 'col_text' */
#endif
} frame_data;
/*