From 33bb54a9452f4be53377a185195a63194016241a Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 4 May 2012 16:56:18 +0000 Subject: file_seek() used to be a wrapper around fseek() or gzseek(), both of which could use lseek() and were thus expensive due to system call overhead. To avoid making a system call for every packet on a sequential read, we maintained a data_offset field in the wtap structure for sequential reads. It's now a routine that just returns information from the FILE_T data structure, so it's cheap. Use it, rather than maintaining the data_offset field. Readers for some file formats need to maintain file offset themselves; have them do so in their private data structures. svn path=/trunk/; revision=42423 --- wiretap/k12.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'wiretap/k12.c') diff --git a/wiretap/k12.c b/wiretap/k12.c index a4cbf0c417..7be553aafb 100644 --- a/wiretap/k12.c +++ b/wiretap/k12.c @@ -410,7 +410,7 @@ static gboolean k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off guint64 ts; guint32 extra_len; - offset = wth->data_offset; + offset = file_tell(wth->fh); /* ignore the record if it isn't a packet */ do { @@ -448,8 +448,6 @@ static gboolean k12_read(wtap *wth, int *err, gchar **err_info, gint64 *data_off } while ( ((type & K12_MASK_PACKET) != K12_REC_PACKET) || !src_id || !src_desc ); - wth->data_offset = offset; - wth->phdr.presence_flags = WTAP_HAS_TS; ts = pntohll(buffer + K12_PACKET_TIMESTAMP); @@ -815,7 +813,6 @@ int k12_open(wtap *wth, int *err, gchar **err_info) { } } while(1); - wth->data_offset = offset; wth->file_type = WTAP_FILE_K12; wth->file_encap = WTAP_ENCAP_K12; wth->snapshot_length = 0; -- cgit v1.2.1