Introduce cap_file_add_fdata() and start using it

svn path=/trunk/; revision=30071
This commit is contained in:
Kovarththanan Rajaratnam 2009-09-22 16:39:48 +00:00
parent e44cb94beb
commit 9398b679e8
3 changed files with 17 additions and 10 deletions

12
cfile.c
View File

@ -51,3 +51,15 @@ init_cap_file(capture_file *cf)
cf->redissecting = FALSE;
}
void
cap_file_add_fdata(capture_file *cf, frame_data *fdata)
{
frame_data *plist_end = cf->plist_end;
fdata->prev = plist_end;
if (plist_end != NULL)
plist_end->next = fdata;
else
cf->plist_start = fdata;
cf->plist_end = fdata;
}

View File

@ -95,4 +95,6 @@ typedef struct _capture_file {
void init_cap_file(capture_file *cf);
void cap_file_add_fdata(capture_file *cf, frame_data *fdata);
#endif /* cfile.h */

13
file.c
View File

@ -1327,8 +1327,7 @@ read_packet(capture_file *cf, dfilter_t *dfcode,
const guchar *buf = wtap_buf_ptr(cf->wth);
frame_data *fdata;
int passed;
frame_data *plist_end;
int row = -1;
int row = -1;
cf->count++;
@ -1360,15 +1359,9 @@ read_packet(capture_file *cf, dfilter_t *dfcode,
}
if (passed) {
plist_end = cf->plist_end;
fdata->prev = plist_end;
if (plist_end != NULL)
plist_end->next = fdata;
else
cf->plist_start = fdata;
cf->plist_end = fdata;
cap_file_add_fdata(cf, fdata);
cf->f_datalen = offset + phdr->caplen;
cf->f_datalen = offset + fdata->cap_len;
if (!cf->redissecting) {
row = add_packet_to_packet_list(fdata, cf, dfcode,