chore: use for(;;) instead of while
In the codebase we have used empty for loop for infinite conditions, so to bring consistency replaced other occurrences of while in the codebase with for loop. PR-URL: https://github.com/libuv/libuv/pull/3128 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
parent
59118e92ca
commit
97709e185f
@ -251,7 +251,7 @@ void name##_SPLAY_MINMAX(struct name *head, int __comp) \
|
||||
SPLAY_LEFT(&__node, field) = SPLAY_RIGHT(&__node, field) = NULL; \
|
||||
__left = __right = &__node; \
|
||||
\
|
||||
while (1) { \
|
||||
for (;;) { \
|
||||
if (__comp < 0) { \
|
||||
__tmp = SPLAY_LEFT((head)->sph_root, field); \
|
||||
if (__tmp == NULL) \
|
||||
|
||||
@ -178,7 +178,7 @@ static void uv__inotify_read(uv_loop_t* loop,
|
||||
/* needs to be large enough for sizeof(inotify_event) + strlen(path) */
|
||||
char buf[4096];
|
||||
|
||||
while (1) {
|
||||
for (;;) {
|
||||
do
|
||||
size = read(loop->inotify_fd, buf, sizeof(buf));
|
||||
while (size == -1 && errno == EINTR);
|
||||
|
||||
@ -49,7 +49,7 @@ int scandir(const char* maindir, struct dirent*** namelist,
|
||||
if (!mdir)
|
||||
return -1;
|
||||
|
||||
while (1) {
|
||||
for (;;) {
|
||||
dirent = readdir(mdir);
|
||||
if (!dirent)
|
||||
break;
|
||||
|
||||
@ -164,7 +164,7 @@ static void uv__stream_osx_select(void* arg) {
|
||||
else
|
||||
max_fd = s->int_fd;
|
||||
|
||||
while (1) {
|
||||
for (;;) {
|
||||
/* Terminate on semaphore */
|
||||
if (uv_sem_trywait(&s->close_sem) == 0)
|
||||
break;
|
||||
@ -195,7 +195,7 @@ static void uv__stream_osx_select(void* arg) {
|
||||
|
||||
/* Empty socketpair's buffer in case of interruption */
|
||||
if (FD_ISSET(s->int_fd, s->sread))
|
||||
while (1) {
|
||||
for (;;) {
|
||||
r = read(s->int_fd, buf, sizeof(buf));
|
||||
|
||||
if (r == sizeof(buf))
|
||||
|
||||
@ -642,7 +642,7 @@ int env_strncmp(const wchar_t* a, int na, const wchar_t* b) {
|
||||
assert(r==nb);
|
||||
B[nb] = L'\0';
|
||||
|
||||
while (1) {
|
||||
for (;;) {
|
||||
wchar_t AA = *A++;
|
||||
wchar_t BB = *B++;
|
||||
if (AA < BB) {
|
||||
|
||||
@ -163,7 +163,7 @@ static int maybe_run_test(int argc, char **argv) {
|
||||
if (strcmp(argv[1], "spawn_helper4") == 0) {
|
||||
notify_parent_process();
|
||||
/* Never surrender, never return! */
|
||||
while (1) uv_sleep(10000);
|
||||
for (;;) uv_sleep(10000);
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "spawn_helper5") == 0) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user