From b28ee8b33149385549f08fc009691773777180f5 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Tue, 12 Apr 2011 02:40:14 +0000 Subject: From Jakub Zawadzki: speed up random access to gzipped files, as per the zran.c example in the zlib source. This means that problems in the file's contents might not be reported when a packet is read, as long as there's no problem in the contents of the file up to the last bit of compressed data for the packet; we now check for errors after finishing the sequential read of the file, at least in some programs, so that shouldn't be an issue (the other programs need to be changed to do so as well). This is necessary in order to be able to read all the packets we saw in the sequential pass; it also lets us get a few more packets from truncated files in some cases. svn path=/trunk/; revision=36577 --- wiretap/wtap.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'wiretap/wtap.c') diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 084d3db4a0..9b44e3a61b 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -655,6 +655,12 @@ wtap_sequential_close(wtap *wth) return ret; } +static void +g_fast_seek_item_free(gpointer data, gpointer user_data _U_) +{ + g_free(data); +} + int wtap_close(wtap *wth) { @@ -679,6 +685,10 @@ wtap_close(wtap *wth) if (wth->priv != NULL) g_free(wth->priv); + if (wth->fast_seek != NULL) { + g_ptr_array_foreach(wth->fast_seek, g_fast_seek_item_free, NULL); + g_ptr_array_free(wth->fast_seek, TRUE); + } g_free(wth); return ret; -- cgit v1.2.3