1) yyerror() isn't necessarily called on a syntax error, so rename the
routine it calls from bpf_syntax_error() to bpf_parser_error(), and
don't have that routine say "syntax error in filter expression", just
have it say "can't parse filter expression".
2) If it *is* called on a syntax error, the error message will probably
be "syntax error", so you end up saying "syntax error in filter
expression: syntax error", which is redundant, so just have it say
"can't parse filter expression".
};
void PCAP_NORETURN
-bpf_syntax_error(compiler_state_t *cstate, const char *msg)
+bpf_parser_error(compiler_state_t *cstate, const char *msg)
{
- bpf_error(cstate, "syntax error in filter expression: %s", msg);
+ bpf_error(cstate, "can't parse filter expression: %s", msg);
/* NOTREACHED */
}
};
void bpf_optimize(compiler_state_t *, struct icode *ic);
-void PCAP_NORETURN bpf_syntax_error(compiler_state_t *, const char *);
+void PCAP_NORETURN bpf_parser_error(compiler_state_t *, const char *);
void PCAP_NORETURN bpf_error(compiler_state_t *, const char *, ...)
PCAP_PRINTFLIKE(2, 3);
static PCAP_NORETURN_DEF void
yyerror(void *yyscanner _U_, compiler_state_t *cstate, const char *msg)
{
- bpf_syntax_error(cstate, msg);
+ bpf_parser_error(cstate, msg);
/* NOTREACHED */
}