aboutsummaryrefslogtreecommitdiffstats
path: root/colors.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 /colors.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 'colors.c')
-rw-r--r--colors.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/colors.c b/colors.c
index 7cd4074e61..2e71a4a7eb 100644
--- a/colors.c
+++ b/colors.c
@@ -1,7 +1,7 @@
/* colors.c
* Definitions for color structures and routines
*
- * $Id: colors.c,v 1.13 1999/10/11 06:39:02 guy Exp $
+ * $Id: colors.c,v 1.14 1999/10/12 05:00:49 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -116,10 +116,10 @@ colors_init(capture_file *cf)
new_color_filter(cf->colors, default_colors[i].proto, default_colors[i].proto);
color_filter(cf,i)->bg_color = color;
- color_filter(cf,i)->c_colorfilter = dfilter_compile(default_colors[i].proto);
- if(color_filter(cf,i)->c_colorfilter == NULL){
+ if (dfilter_compile(default_colors[i].proto,
+ &color_filter(cf,i)->c_colorfilter) != 0) {
simple_dialog(ESD_TYPE_WARN, NULL,
- "Cannot compile default filter %s.\n%s",
+ "Cannot compile default color filter %s.\n%s",
default_colors[i].proto, dfilter_error_msg);
/* should reject this filter */
}
@@ -243,10 +243,9 @@ read_filters(capture_file *cf)
name, filter, &bg_r, &bg_g, &bg_b, &fg_r, &fg_g, &fg_b) == 8){
/* we got a filter */
- temp_dfilter = dfilter_compile(filter);
- if(temp_dfilter == NULL){
+ if(dfilter_compile(filter, &temp_dfilter) != 0){
simple_dialog(ESD_TYPE_WARN, NULL,
- "Could not compile filter %s from saved filters because\n%s",
+ "Could not compile color filter %s from saved filters.\n%s",
name, dfilter_error_msg);
continue;
}
@@ -589,9 +588,7 @@ colorize_ok_cb (GtkButton *button,
- compiled_filter = dfilter_compile(filter_text);
-
- if(compiled_filter == NULL ){
+ if(dfilter_compile(filter_text, &compiled_filter) != 0 ){
simple_dialog(ESD_TYPE_WARN, NULL, "Filter \"%s\" did not compile correctly.\n"
" Please try again. Filter unchanged.\n%s\n", filter_name,dfilter_error_msg);
} else {