]> The Tcpdump Group git mirrors - libpcap/commitdiff
Don't say "syntax error" twice.
authorGuy Harris <[email protected]>
Wed, 18 Jul 2018 03:34:37 +0000 (20:34 -0700)
committerGuy Harris <[email protected]>
Wed, 18 Jul 2018 03:34:53 +0000 (20:34 -0700)
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".

gencode.c
gencode.h
grammar.y

index dd44bc9fbe40174efc171f976b936cad6b45e671..42c3bdcbd0835237ff6c5ec4958e1b33cc213b20 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -418,9 +418,9 @@ struct _compiler_state {
 };
 
 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 */
 }
 
index 88def5a8ad280b6e54cf0296a640b420466d6147..7c80428762e12baa33abf67069ae3015d62e6ad0 100644 (file)
--- a/gencode.h
+++ b/gencode.h
@@ -387,7 +387,7 @@ struct icode {
 };
 
 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);
 
index be80e2bfcfdefa3fee0a54bea15fcbeb5dacc297..9ff23bdc8ab8181f9b8f2615c844da908886a222 100644 (file)
--- a/grammar.y
+++ b/grammar.y
@@ -221,7 +221,7 @@ static struct qual qerr = { Q_UNDEF, Q_UNDEF, Q_UNDEF, Q_UNDEF };
 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 */
 }