aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-03-20 11:43:56 -0700
committerGuy Harris <guy@alum.mit.edu>2018-03-20 11:43:56 -0700
commitd6a0991279f0341f94ea7a76df5c8c178c93d08c (patch)
treedf56e0b6823fc5134d7813ff40f52a3b70e8cda2
parente0c66c587d2ebf40f0e8086087fdb7956b091b85 (diff)
Use for (;;) rather than while (1).
That squelches "conditional expression is constant" warnings from MSVC.
-rw-r--r--bpf/net/bpf_filter.c2
-rw-r--r--nametoaddr.c2
-rw-r--r--optimize.c12
-rw-r--r--pcap-npf.c2
-rw-r--r--pcap-rpcap.c2
5 files changed, 10 insertions, 10 deletions
diff --git a/bpf/net/bpf_filter.c b/bpf/net/bpf_filter.c
index 330dacc4..ae1b950b 100644
--- a/bpf/net/bpf_filter.c
+++ b/bpf/net/bpf_filter.c
@@ -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) {
diff --git a/nametoaddr.c b/nametoaddr.c
index c69c36dd..e7b7134e 100644
--- a/nametoaddr.c
+++ b/nametoaddr.c
@@ -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';
diff --git a/optimize.c b/optimize.c
index 81f875b0..65396c4e 100644
--- a/optimize.c
+++ b/optimize.c
@@ -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);
diff --git a/pcap-npf.c b/pcap-npf.c
index 837f4908..1419470b 100644
--- a/pcap-npf.c
+++ b/pcap-npf.c
@@ -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;
/*
diff --git a/pcap-rpcap.c b/pcap-rpcap.c
index 42a59ebc..94a3834c 100644
--- a/pcap-rpcap.c
+++ b/pcap-rpcap.c
@@ -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),