]> The Tcpdump Group git mirrors - libpcap/commitdiff
ptimize: move the definition of extrajmps to the block in which it's used.
authorGuy Harris <[email protected]>
Wed, 17 Jun 2020 23:30:14 +0000 (16:30 -0700)
committerGuy Harris <[email protected]>
Wed, 17 Jun 2020 23:30:14 +0000 (16:30 -0700)
That makes it a bit clearer than it's not used outside that block;
compilers and static analyzers can determine that, but this makes it
easier for human analyzers to see that, and thus that it can neveer be
bigger than 2.

optimize.c

index 1336a98d4632531ae2d2885d298703d6396e49b9..2c9c4b396c02e3e060da46a28fa964606c61820c 100644 (file)
@@ -2688,7 +2688,6 @@ convert_code_r(conv_state_t *conv_state, struct icode *ic, struct block *p)
        struct slist *src;
        u_int slen;
        u_int off;
-       u_char extrajmps;       /* number of extra jumps inserted */
        struct slist **offset = NULL;
 
        if (p == 0 || isMarked(ic, p))
@@ -2812,7 +2811,8 @@ filled:
        dst->code = (u_short)p->s.code;
        dst->k = p->s.k;
        if (JT(p)) {
-               extrajmps = 0;
+               /* number of extra jumps inserted */
+               u_char extrajmps = 0;
                off = JT(p)->offset - (p->offset + slen) - 1;
                if (off >= 256) {
                    /* offset too large for branch, must add a jump */