mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
tree-wide: replace while(1) by for(;;) everywhere
Another Coccinelle script.
This commit is contained in:
parent
1f6b411372
commit
57255510c9
12
coccinelle/while-true.cocci
Normal file
12
coccinelle/while-true.cocci
Normal file
@ -0,0 +1,12 @@
|
||||
@@
|
||||
statement s;
|
||||
@@
|
||||
- while (true)
|
||||
+ for (;;)
|
||||
s
|
||||
@@
|
||||
statement s;
|
||||
@@
|
||||
- while (1)
|
||||
+ for (;;)
|
||||
s
|
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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: {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user