aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cfile.c12
-rw-r--r--cfile.h2
-rw-r--r--file.c13
3 files changed, 17 insertions, 10 deletions
diff --git a/cfile.c b/cfile.c
index e9f1f08332..00498281e2 100644
--- a/cfile.c
+++ b/cfile.c
@@ -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;
+}
+
diff --git a/cfile.h b/cfile.h
index 9608d70001..613bc47cb4 100644
--- a/cfile.h
+++ b/cfile.h
@@ -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 */
diff --git a/file.c b/file.c
index ad8af0e8dd..ee8a9bf949 100644
--- a/file.c
+++ b/file.c
@@ -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,