aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/wtap.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2011-04-12 02:40:14 +0000
committerGuy Harris <guy@alum.mit.edu>2011-04-12 02:40:14 +0000
commitb28ee8b33149385549f08fc009691773777180f5 (patch)
treeebb3a5291dd0439aed7f8651d6ea30c5ddf49c5e /wiretap/wtap.c
parente5fe0128d75998d5bd8fc2342e3df8d03240641d (diff)
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
Diffstat (limited to 'wiretap/wtap.c')
-rw-r--r--wiretap/wtap.c10
1 files changed, 10 insertions, 0 deletions
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;