mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 03:19:35 +03:00
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:
parent
e6203d288a
commit
9c9dcd6e04
@ -47,7 +47,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
static const int TRUE = 1;
|
|
||||||
static char *filebase;
|
static char *filebase;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -65,7 +64,7 @@ mover(void *a)
|
|||||||
|
|
||||||
len = strlen(filebase) + 5;
|
len = strlen(filebase) + 5;
|
||||||
|
|
||||||
while (TRUE) {
|
for (;;) {
|
||||||
idx = pickidx();
|
idx = pickidx();
|
||||||
(void) snprintf(buf, len, "%s.%03d", filebase, idx);
|
(void) snprintf(buf, len, "%s.%03d", filebase, idx);
|
||||||
ret = rename(filebase, buf);
|
ret = rename(filebase, buf);
|
||||||
@ -85,7 +84,7 @@ cleaner(void *a)
|
|||||||
|
|
||||||
len = strlen(filebase) + 5;
|
len = strlen(filebase) + 5;
|
||||||
|
|
||||||
while (TRUE) {
|
for (;;) {
|
||||||
idx = pickidx();
|
idx = pickidx();
|
||||||
(void) snprintf(buf, len, "%s.%03d", filebase, idx);
|
(void) snprintf(buf, len, "%s.%03d", filebase, idx);
|
||||||
ret = remove(buf);
|
ret = remove(buf);
|
||||||
@ -102,7 +101,7 @@ writer(void *a)
|
|||||||
int *fd = (int *)a;
|
int *fd = (int *)a;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
while (TRUE) {
|
for (;;) {
|
||||||
if (*fd != -1)
|
if (*fd != -1)
|
||||||
(void) close (*fd);
|
(void) close (*fd);
|
||||||
|
|
||||||
@ -143,7 +142,7 @@ main(int argc, char **argv)
|
|||||||
(void) pthread_create(&tid, NULL, cleaner, NULL);
|
(void) pthread_create(&tid, NULL, cleaner, NULL);
|
||||||
(void) pthread_create(&tid, NULL, writer, (void *) &fd);
|
(void) pthread_create(&tid, NULL, writer, (void *) &fd);
|
||||||
|
|
||||||
while (TRUE) {
|
for (;;) {
|
||||||
int ret;
|
int ret;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user