tree-wide: replace while(1) by for(;;) everywhere

Another Coccinelle script.
This commit is contained in:
Lennart Poettering 2015-09-09 14:33:32 +02:00
parent 1f6b411372
commit 57255510c9
10 changed files with 21 additions and 9 deletions

View File

@ -0,0 +1,12 @@
@@
statement s;
@@
- while (true)
+ for (;;)
s
@@
statement s;
@@
- while (1)
+ for (;;)
s

View File

@ -888,7 +888,7 @@ static struct ps_struct *get_next_ps(struct ps_struct *ps, struct ps_struct *ps_
return ps->next;
/* go back for parent siblings */
while (1) {
for (;;) {
if (ps->parent && ps->parent->next)
return ps->parent->next;

View File

@ -94,7 +94,7 @@ static int get_line(RemoteSource *source, char **line, size_t *size) {
assert(source->buf == NULL || source->size > 0);
assert(source->fd >= 0);
while (true) {
for (;;) {
if (source->buf) {
size_t start = MAX(source->scanned, source->offset);

View File

@ -518,7 +518,7 @@ static int process_http_upload(
} else
finished = true;
while (true) {
for (;;) {
r = process_source(source, arg_compress, arg_seal);
if (r == -EAGAIN)
break;

View File

@ -17,7 +17,7 @@ static ssize_t write_entry(char *buf, size_t size, Uploader *u) {
assert(size <= SSIZE_MAX);
while (true) {
for (;;) {
switch(u->entry_state) {
case ENTRY_CURSOR: {

View File

@ -828,7 +828,7 @@ int main(int argc, char **argv) {
"READY=1\n"
"STATUS=Processing input...");
while (true) {
for (;;) {
r = sd_event_get_state(u.events);
if (r < 0)
break;

View File

@ -432,7 +432,7 @@ int main(int argc, char *argv[])
if (udev == NULL)
return 0;
while (1) {
for (;;) {
int option;
option = getopt_long(argc, argv, "xh", options, NULL);

View File

@ -868,7 +868,7 @@ int main(int argc, char *argv[])
if (udev == NULL)
goto exit;
while (1) {
for (;;) {
int option;
option = getopt_long(argc, argv, "deluh", options, NULL);

View File

@ -364,7 +364,7 @@ int main(int argc, char **argv)
goto exit;
}
while (1) {
for (;;) {
int option;
option = getopt_long(argc, argv, "ardh", options, NULL);

View File

@ -190,7 +190,7 @@ static int get_file_options(struct udev *udev,
*newargv = NULL;
lineno = 0;
while (1) {
for (;;) {
vendor_in = model_in = options_in = NULL;
buf = fgets(buffer, MAX_BUFFER_LEN, f);