]> The Tcpdump Group git mirrors - libpcap/commitdiff
Use for (;;) rather than while (1).
authorGuy Harris <[email protected]>
Tue, 20 Mar 2018 18:43:56 +0000 (11:43 -0700)
committerGuy Harris <[email protected]>
Tue, 20 Mar 2018 18:43:56 +0000 (11:43 -0700)
That squelches "conditional expression is constant" warnings from MSVC.

bpf/net/bpf_filter.c
nametoaddr.c
optimize.c
pcap-npf.c
pcap-rpcap.c

index 330dacc49dd2029bef527a129682f6db502c6467..ae1b950b835baec7f0f3b84b08691de2a129f72d 100644 (file)
@@ -236,7 +236,7 @@ bpf_filter_with_aux_data(const struct bpf_insn *pc, const u_char *p,
        A = 0;
        X = 0;
        --pc;
-       while (1) {
+       for (;;) {
                ++pc;
                switch (pc->code) {
 
index c69c36dddbbd5629cca12d1a9c1b723abe5da070..e7b7134ee53cc557ca3135aed181962f29189837 100644 (file)
@@ -632,7 +632,7 @@ __pcap_atoin(const char *s, bpf_u_int32 *addr)
 
        *addr = 0;
        len = 0;
-       while (1) {
+       for (;;) {
                n = 0;
                while (*s && *s != '.')
                        n = n * 10 + *s++ - '0';
index 81f875b01124b8568f62f6593e42036dae2d7969..65396c4e0c6037004a143ac9a071fc41cdb289d7 100644 (file)
@@ -1480,7 +1480,7 @@ or_pullup(opt_state_t *opt_state, struct block *b)
                diffp = &JF(b->in_edges->pred);
 
        at_top = 1;
-       while (1) {
+       for (;;) {
                if (*diffp == 0)
                        return;
 
@@ -1497,7 +1497,7 @@ or_pullup(opt_state_t *opt_state, struct block *b)
                at_top = 0;
        }
        samep = &JF(*diffp);
-       while (1) {
+       for (;;) {
                if (*samep == 0)
                        return;
 
@@ -1571,7 +1571,7 @@ and_pullup(opt_state_t *opt_state, struct block *b)
                diffp = &JF(b->in_edges->pred);
 
        at_top = 1;
-       while (1) {
+       for (;;) {
                if (*diffp == 0)
                        return;
 
@@ -1588,7 +1588,7 @@ and_pullup(opt_state_t *opt_state, struct block *b)
                at_top = 0;
        }
        samep = &JT(*diffp);
-       while (1) {
+       for (;;) {
                if (*samep == 0)
                        return;
 
@@ -1812,7 +1812,7 @@ mark_code(struct icode *ic)
 static int
 eq_slist(struct slist *x, struct slist *y)
 {
-       while (1) {
+       for (;;) {
                while (x && x->s.code == NOP)
                        x = x->next;
                while (y && y->s.code == NOP)
@@ -2256,7 +2256,7 @@ icode_to_fcode(compiler_state_t *cstate, struct icode *ic,
         * Loop doing convert_code_r() until no branches remain
         * with too-large offsets.
         */
-       while (1) {
+       for (;;) {
            unMarkAll(ic);
            n = *lenp = count_stmts(ic, root);
 
index 837f49087f01c009e6a44b8fb9640299dc369cd1..1419470b4a077dbd48a24b99a1e5e158de2db302 100644 (file)
@@ -527,7 +527,7 @@ pcap_read_win32_npf(pcap_t *p, int cnt, pcap_handler callback, u_char *user)
         */
 #define bhp ((struct bpf_hdr *)bp)
        ep = bp + cc;
-       while (1) {
+       for (;;) {
                register int caplen, hdrlen;
 
                /*
index 42a59ebc938a4bd8ee2d77b7d953bb85f610d60c..94a3834c9ae35f4e4ed561d0406d5f3aeca233f5 100644 (file)
@@ -1272,7 +1272,7 @@ static int pcap_startcapture_remote(pcap_t *fp)
                 * Loop until the buffer size is OK or the original
                 * socket buffer size is larger than this one.
                 */
-               while (1)
+               for (;;)
                {
                        res = setsockopt(sockdata, SOL_SOCKET, SO_RCVBUF,
                            (char *)&(server_sockbufsize),