aboutsummaryrefslogtreecommitdiffstats
path: root/file.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-07-15 15:48:29 -0700
committerGuy Harris <guy@alum.mit.edu>2014-07-15 22:48:53 +0000
commitf9f6fa74fd78d78b268b49b84ad9f37175321cdc (patch)
tree583c1474f3943e90382e0a8ccdf8775b1f1040ec /file.c
parent9d436346c3d3f85b103f855df3eaa09d2bbfd6c1 (diff)
Get rid of cf_reset_state() - it's only called from one place.
Change-Id: I48521bbaa898c99286e6bb5e40281aba7701ed4d Reviewed-on: https://code.wireshark.org/review/3062 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'file.c')
-rw-r--r--file.c45
1 files changed, 15 insertions, 30 deletions
diff --git a/file.c b/file.c
index 819660cf61..25d1ec2684 100644
--- a/file.c
+++ b/file.c
@@ -106,8 +106,6 @@
gboolean auto_scroll_live;
#endif
-static void cf_reset_state(capture_file *cf);
-
static int read_packet(capture_file *cf, dfilter_t *dfcode, epan_dissect_t *edt,
column_info *cinfo, gint64 offset);
@@ -439,22 +437,21 @@ cf_add_encapsulation_type(capture_file *cf, int encap)
g_array_append_val(cf->linktypes, encap);
}
-/*
- * Reset the state for the currently closed file, but don't do the
- * UI callbacks; this is for use in "cf_open()", where we don't
- * want the UI to go from "file open" to "file closed" back to
- * "file open", we want it to go from "old file open" to "new file
- * open and being read".
- *
- * XXX - currently, cf_open() calls cf_close(), rather than
- * cf_reset_state().
- */
-static void
-cf_reset_state(capture_file *cf)
+/* Reset everything to a pristine state */
+void
+cf_close(capture_file *cf)
{
+ if (cf->state == FILE_CLOSED)
+ return; /* Nothing to do */
+
/* Die if we're in the middle of reading a file. */
g_assert(cf->state != FILE_READ_IN_PROGRESS);
+ cf_callback_invoke(cf_cb_file_closing, cf);
+
+ /* close things, if not already closed before */
+ color_filters_cleanup();
+
if (cf->wth) {
wtap_close(cf->wth);
cf->wth = NULL;
@@ -516,25 +513,13 @@ cf_reset_state(capture_file *cf)
reset_tap_listeners();
+ epan_free(cf->epan);
+ cf->epan = NULL;
+
/* We have no file open. */
cf->state = FILE_CLOSED;
-}
-
-/* Reset everything to a pristine state */
-void
-cf_close(capture_file *cf)
-{
- if (cf->state != FILE_CLOSED) {
- cf_callback_invoke(cf_cb_file_closing, cf);
-
- /* close things, if not already closed before */
- color_filters_cleanup();
- cf_reset_state(cf);
- epan_free(cf->epan);
- cf->epan = NULL;
- cf_callback_invoke(cf_cb_file_closed, cf);
- }
+ cf_callback_invoke(cf_cb_file_closed, cf);
}
static float