aboutsummaryrefslogtreecommitdiffstats
path: root/dfilter.c
diff options
context:
space:
mode:
authorGilbert Ramirez <gram@alumni.rice.edu>2000-03-20 22:52:48 +0000
committerGilbert Ramirez <gram@alumni.rice.edu>2000-03-20 22:52:48 +0000
commite29f2705bf4974fc5fbdc8fb3877d774cc86d18c (patch)
tree98d32c0fb8a29652085167d2cef6efc6e780eecb /dfilter.c
parenta56b23acd8cfefb2f0743c3f1492f15f8b73caa2 (diff)
Change dfilter_init() to check for empty-string abbreviations and for
duplicate abbreviations. All mods to packet-*.c files are fixes to remove those cases. svn path=/trunk/; revision=1733
Diffstat (limited to 'dfilter.c')
-rw-r--r--dfilter.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/dfilter.c b/dfilter.c
index f948246535..4a792c1fa4 100644
--- a/dfilter.c
+++ b/dfilter.c
@@ -1,7 +1,7 @@
/* dfilter.c
* Routines for display filters
*
- * $Id: dfilter.c,v 1.32 1999/11/15 06:32:13 gram Exp $
+ * $Id: dfilter.c,v 1.33 2000/03/20 22:52:41 gram Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -114,10 +114,16 @@ dfilter_init(void)
num_symbols = proto_registrar_n();
for (i=0; i < num_symbols; i++) {
s = proto_registrar_get_abbrev(i);
- if (s) {
- symbol = DFILTER_LEX_ABBREV_OFFSET + i;
- g_tree_insert(dfilter_tokens, s, GINT_TO_POINTER(symbol));
- }
+ g_assert(s); /* Not Null */
+ g_assert(s[0] != 0); /* Not empty string */
+ /* Make sure we don't have duplicate abbreviation */
+ if (g_tree_lookup(dfilter_tokens, s)) {
+ g_message("Already have abbreviation \"%s\"", s);
+ g_assert(0);
+ }
+ /*g_message("Adding %s", s);*/
+ symbol = DFILTER_LEX_ABBREV_OFFSET + i;
+ g_tree_insert(dfilter_tokens, s, GINT_TO_POINTER(symbol));
}
}