]> The Tcpdump Group git mirrors - libpcap/commitdiff
Give the value of qualifiers a defined type.
authorGuy Harris <[email protected]>
Wed, 21 Mar 2018 03:39:49 +0000 (20:39 -0700)
committerGuy Harris <[email protected]>
Wed, 21 Mar 2018 03:39:49 +0000 (20:39 -0700)
This should also squelch warnings.

gencode.h
grammar.y

index 58828ecd5854b3f43eb28b4fed251a83278e0f33..41dcdf603c3321f4885ee930abc56410775f346e 100644 (file)
--- a/gencode.h
+++ b/gencode.h
@@ -55,6 +55,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+/* Type of a qualifier. */
+typedef unsigned char qualval;
+
 /* Address qualifiers. */
 
 #define Q_HOST         1
@@ -278,9 +281,9 @@ struct arth {
 };
 
 struct qual {
-       unsigned char addr;
-       unsigned char proto;
-       unsigned char dir;
+       qualval addr;
+       qualval proto;
+       qualval dir;
        unsigned char pad;
 };
 
index 9af9ac86e9b0555ce351eebfb4b2efbffc343e78..be62de5f0b896efa84d0b1247e38c644826ab096 100644 (file)
--- a/grammar.y
+++ b/grammar.y
@@ -90,9 +90,9 @@ DIAG_ON_BYACC
 #include "os-proto.h"
 #endif
 
-#define QSET(q, p, d, a) (q).proto = (unsigned char)(p),\
-                        (q).dir = (unsigned char)(d),\
-                        (q).addr = (unsigned char)(a)
+#define QSET(q, p, d, a) (q).proto = (p),\
+                        (q).dir = (d),\
+                        (q).addr = (a)
 
 struct tok {
        int v;                  /* value */
@@ -272,6 +272,7 @@ DIAG_OFF_BYACC
 
 %union {
        int i;
+       qualval q;
        bpf_u_int32 h;
        u_char *e;
        char *s;
@@ -288,7 +289,7 @@ DIAG_OFF_BYACC
 
 %type  <blk>   expr id nid pid term rterm qid
 %type  <blk>   head
-%type  <i>     pqual dqual aqual ndaqual
+%type  <q>     pqual dqual aqual ndaqual
 %type  <a>     arth narth
 %type  <i>     byteop pname pnum relop irelop
 %type  <blk>   and or paren not null prog