aboutsummaryrefslogtreecommitdiffstats
path: root/gtk/main.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>1999-10-12 05:01:07 +0000
committerGuy Harris <guy@alum.mit.edu>1999-10-12 05:01:07 +0000
commitf3da72ef2fd7486be06c6bb69418d4416fdaf3e6 (patch)
tree745d48db7c24775225b32326c4721af356973484 /gtk/main.c
parent1efcb7b2cfc60043e672d5cc4c78aabbe50f5416 (diff)
Have "dfilter_compile()" return 0 on success and 1 on failure, and
return the pointer to the compiled filter through a pointer argument. Have it check whether the filter is a null filter and, if so, free up the filter and supply a filter pointer, rather than obliging its callers to check whether the filter actually has any code. (Well, they may want to check if the filter is null, so that they don't save a pointer to the filter text, e.g. so that the display filter displays as "none" rather than as a blank string in the summary box.) In the process, fix the check in "gtk/file_dlg.c" that tests whether the read filter compiled successfully. svn path=/trunk/; revision=812
Diffstat (limited to 'gtk/main.c')
-rw-r--r--gtk/main.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/gtk/main.c b/gtk/main.c
index f58481ea4c..7a747cff2e 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -1,6 +1,6 @@
/* main.c
*
- * $Id: main.c,v 1.20 1999/10/11 18:02:46 guy Exp $
+ * $Id: main.c,v 1.21 1999/10/12 05:01:07 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -862,14 +862,16 @@ main(int argc, char *argv[])
up on top of us. */
if (cf_name) {
if (rfilter != NULL) {
- rfcode = dfilter_compile(rfilter);
- if (rfcode == NULL) {
+ if (dfilter_compile(rfilter, &rfcode) != 0) {
simple_dialog(ESD_TYPE_WARN, NULL, dfilter_error_msg);
rfilter_parse_failed = TRUE;
}
}
if (!rfilter_parse_failed) {
if ((err = open_cap_file(cf_name, &cf)) == 0) {
+ /* "open_cap_file()" succeeded, so it closed the previous
+ capture file, and thus destroyed any previous read filter
+ attached to "cf". */
cf.rfcode = rfcode;
err = read_cap_file(&cf);
s = strrchr(cf_name, '/');
@@ -878,6 +880,9 @@ main(int argc, char *argv[])
*s = '\0';
}
set_menu_sensitivity("/File/Save As...", TRUE);
+ } else {
+ dfilter_destroy(rfcode);
+ cf.rfcode = NULL;
}
}
}