aboutsummaryrefslogtreecommitdiffstats
path: root/filters.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2001-02-03 06:10:11 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2001-02-03 06:10:11 +0000
commit6db46b746a9ed7b2a53c3e465c999faf4eee979d (patch)
treed0d07e4b8e7da5e8db3d56b0709053c5ec3c02fa /filters.c
parenta57099ff71a5fa8d8b16495b90d908244182150a (diff)
Increment the line number for every line seen.
Fix the handling of one error case. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@2981 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'filters.c')
-rw-r--r--filters.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/filters.c b/filters.c
index b605236267..398e29a038 100644
--- a/filters.c
+++ b/filters.c
@@ -1,7 +1,7 @@
/* filters.c
* Code for reading and writing the filters file.
*
- * $Id: filters.c,v 1.5 2001/02/03 06:03:42 guy Exp $
+ * $Id: filters.c,v 1.6 2001/02/03 06:10:11 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -181,7 +181,7 @@ read_filter_list(filter_list_type_t list, char **pref_path_return,
filt_expr_len = INIT_BUF_SIZE;
filt_expr = g_malloc(filt_expr_len + 1);
- for (;;) {
+ for (line = 1; ; line++) {
/* Lines in a filter file are of the form
"name" expression
@@ -195,7 +195,6 @@ read_filter_list(filter_list_type_t list, char **pref_path_return,
while ((c = getc(ff)) != EOF && isspace(c)) {
if (c == '\n') {
/* Blank line. */
- line++; /* next line */
continue;
}
}
@@ -210,7 +209,6 @@ read_filter_list(filter_list_type_t list, char **pref_path_return,
line);
while (c != '\n')
c = getc(ff); /* skip to the end of the line */
- line++; /* next line */
continue;
}
@@ -259,19 +257,13 @@ read_filter_list(filter_list_type_t list, char **pref_path_return,
/* No newline seen before end-of-line */
g_warning("'%s' line %d doesn't have a closing quote.", ff_path,
line);
- line++; /* next line */
continue;
}
/* Skip over separating white space, if any. */
while ((c = getc(ff)) != EOF && isspace(c)) {
- if (c == '\n') {
- /* No filter expression */
- g_warning("'%s' line %d doesn't have a filter expression.", ff_path,
- line);
- line++; /* next line */
- continue;
- }
+ if (c == '\n')
+ break;
}
if (c == EOF) {
@@ -283,6 +275,13 @@ read_filter_list(filter_list_type_t list, char **pref_path_return,
break; /* nothing more to read */
}
+ if (c == '\n') {
+ /* No filter expression */
+ g_warning("'%s' line %d doesn't have a filter expression.", ff_path,
+ line);
+ continue;
+ }
+
/* "c" is the first non-white-space character; it's the first
character of the filter expression. */
filt_expr_index = 0;