]> The Tcpdump Group git mirrors - libpcap/commitdiff
ATM: Merge two functions into gen_atmtype_abbrev().
authorDenis Ovsienko <[email protected]>
Mon, 31 Mar 2025 18:15:32 +0000 (19:15 +0100)
committerDenis Ovsienko <[email protected]>
Tue, 8 Apr 2025 10:02:21 +0000 (11:02 +0100)
These bits of code are easier to follow as case blocks rather than as
separate functions.

gencode.c

index 0a162ae2472fe188d119beb7077caa3467fb49a6..7e9d6cd8d04f50a6990879b118ebfee8c5e421fa 100644 (file)
--- a/gencode.c
+++ b/gencode.c
@@ -9755,28 +9755,6 @@ gen_atm_vci(compiler_state_t *cstate, const uint16_t v)
        return gen_atmfield_code_internal(cstate, A_VCI, v, BPF_JEQ, 0);
 }
 
-static struct block *
-gen_atmtype_metac(compiler_state_t *cstate)
-{
-       struct block *b0, *b1;
-
-       b0 = gen_atm_vpi(cstate, 0);
-       b1 = gen_atm_vci(cstate, 1);
-       gen_and(b0, b1);
-       return b1;
-}
-
-static struct block *
-gen_atmtype_sc(compiler_state_t *cstate)
-{
-       struct block *b0, *b1;
-
-       b0 = gen_atm_vpi(cstate, 0);
-       b1 = gen_atm_vci(cstate, 5);
-       gen_and(b0, b1);
-       return b1;
-}
-
 static struct block *
 gen_atm_prototype(compiler_state_t *cstate, const uint8_t v)
 {
@@ -9826,7 +9804,9 @@ gen_atmtype_abbrev(compiler_state_t *cstate, int type)
 
        case A_METAC:
                /* Get all packets in Meta signalling Circuit */
-               b1 = gen_atmtype_metac(cstate);
+               b0 = gen_atm_vpi(cstate, 0);
+               b1 = gen_atm_vci(cstate, 1);
+               gen_and(b0, b1);
                break;
 
        case A_BCC:
@@ -9852,7 +9832,9 @@ gen_atmtype_abbrev(compiler_state_t *cstate, int type)
 
        case A_SC:
                /*  Get all packets in connection Signalling Circuit */
-               b1 = gen_atmtype_sc(cstate);
+               b0 = gen_atm_vpi(cstate, 0);
+               b1 = gen_atm_vci(cstate, 5);
+               gen_and(b0, b1);
                break;
 
        case A_ILMIC:
@@ -10143,7 +10125,7 @@ gen_atmmulti_abbrev(compiler_state_t *cstate, int type)
                gen_or(b0, b1);
                b0 = gen_msg_abbrev(cstate, RELEASE_DONE);
                gen_or(b0, b1);
-               b0 = gen_atmtype_sc(cstate);
+               b0 = gen_atmtype_abbrev(cstate, A_SC);
                gen_and(b0, b1);
                break;
 
@@ -10157,7 +10139,7 @@ gen_atmmulti_abbrev(compiler_state_t *cstate, int type)
                gen_or(b0, b1);
                b0 = gen_msg_abbrev(cstate, RELEASE_DONE);
                gen_or(b0, b1);
-               b0 = gen_atmtype_metac(cstate);
+               b0 = gen_atmtype_abbrev(cstate, A_METAC);
                gen_and(b0, b1);
                break;