Prefer for (;;) to while (TRUE)

Defining a special constant to make an infinite loop is excessive,
especially when the name clashes with symbols commonly defined on
some platforms (ie FreeBSD).

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Reviewed-by: John Kennedy <john.kennedy@delphix.com
Signed-off-by: Ryan Moeller <ryan@ixsystems.com>
Closes #9219
This commit is contained in:
Ryan Moeller 2019-08-28 13:38:40 -04:00 committed by Brian Behlendorf
parent e6203d288a
commit 9c9dcd6e04

View File

@ -47,7 +47,6 @@
#include <unistd.h>
#include <strings.h>
static const int TRUE = 1;
static char *filebase;
static int
@ -65,7 +64,7 @@ mover(void *a)
len = strlen(filebase) + 5;
while (TRUE) {
for (;;) {
idx = pickidx();
(void) snprintf(buf, len, "%s.%03d", filebase, idx);
ret = rename(filebase, buf);
@ -85,7 +84,7 @@ cleaner(void *a)
len = strlen(filebase) + 5;
while (TRUE) {
for (;;) {
idx = pickidx();
(void) snprintf(buf, len, "%s.%03d", filebase, idx);
ret = remove(buf);
@ -102,7 +101,7 @@ writer(void *a)
int *fd = (int *)a;
int ret;
while (TRUE) {
for (;;) {
if (*fd != -1)
(void) close (*fd);
@ -143,7 +142,7 @@ main(int argc, char **argv)
(void) pthread_create(&tid, NULL, cleaner, NULL);
(void) pthread_create(&tid, NULL, writer, (void *) &fd);
while (TRUE) {
for (;;) {
int ret;
struct stat st;