coccinelle: s/while({1,true})/for(;;)/

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2019-02-08 23:57:06 +01:00
parent 99dc3a338d
commit 51a8a74c07
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D
10 changed files with 24 additions and 12 deletions

View File

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

View File

@ -492,7 +492,7 @@ See the lxc-init man page for further information.\n\n");
static int arguments_parse(struct arguments *args, int argc, static int arguments_parse(struct arguments *args, int argc,
char *const argv[]) char *const argv[])
{ {
while (true) { for (;;) {
int c; int c;
int index = 0; int index = 0;

View File

@ -3365,7 +3365,7 @@ static int copy_file(const char *old, const char *new)
return -1; return -1;
} }
while (1) { for (;;) {
len = lxc_read_nointr(in, buf, 8096); len = lxc_read_nointr(in, buf, 8096);
if (len < 0) { if (len < 0) {
SYSERROR("Error reading old file %s", old); SYSERROR("Error reading old file %s", old);
@ -4100,7 +4100,7 @@ static int get_next_index(const char *lxcpath, char *cname)
fname = must_realloc(NULL, strlen(lxcpath) + 20); fname = must_realloc(NULL, strlen(lxcpath) + 20);
while (1) { for (;;) {
sprintf(fname, "%s/snap%d", lxcpath, i); sprintf(fname, "%s/snap%d", lxcpath, i);
ret = stat(fname, &sb); ret = stat(fname, &sb);

View File

@ -1974,7 +1974,7 @@ char *lxc_mkifname(char *template)
} }
/* Generate random names until we find one that doesn't exist. */ /* Generate random names until we find one that doesn't exist. */
while (true) { for (;;) {
name[0] = '\0'; name[0] = '\0';
(void)strlcpy(name, template, IFNAMSIZ); (void)strlcpy(name, template, IFNAMSIZ);

View File

@ -259,7 +259,7 @@ static bool mkdir_parent(const char *root, char *path)
return true; return true;
b = path + strlen(root) + 1; b = path + strlen(root) + 1;
while (true) { for (;;) {
while (*b && (*b == '/')) while (*b && (*b == '/'))
b++; b++;
if (!*b) if (!*b)
@ -878,7 +878,7 @@ static char *cgv1_get_current_cgroup(char *basecginfo, char *controller)
p = basecginfo; p = basecginfo;
while (true) { for (;;) {
p = strchr(p, ':'); p = strchr(p, ':');
if (!p) if (!p)
return NULL; return NULL;

View File

@ -805,7 +805,7 @@ static int btrfs_recursive_destroy(const char *path)
sk->max_transid = (u64)-1; sk->max_transid = (u64)-1;
sk->nr_items = 4096; sk->nr_items = 4096;
while(1) { for (;;) {
ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args); ret = ioctl(fd, BTRFS_IOC_TREE_SEARCH, &args);
e = errno; e = errno;
if (ret < 0) { if (ret < 0) {

View File

@ -72,7 +72,7 @@ bool attach_nbd(char *src, struct lxc_conf *conf)
if (p) if (p)
*p = '\0'; *p = '\0';
while (1) { for (;;) {
sprintf(path, "/dev/nbd%d", i); sprintf(path, "/dev/nbd%d", i);
if (!file_exists(path)) if (!file_exists(path))

View File

@ -69,7 +69,7 @@ char **lxc_va_arg_list_to_argv(va_list ap, size_t skip, int do_strdup)
* constantly... * constantly...
*/ */
va_copy(ap2, ap); va_copy(ap2, ap);
while (1) { for (;;) {
char *arg = va_arg(ap2, char *); char *arg = va_arg(ap2, char *);
if (!arg) if (!arg)
break; break;
@ -82,7 +82,7 @@ char **lxc_va_arg_list_to_argv(va_list ap, size_t skip, int do_strdup)
return NULL; return NULL;
count = skip; count = skip;
while (1) { for (;;) {
char *arg = va_arg(ap, char *); char *arg = va_arg(ap, char *);
if (!arg) if (!arg)
break; break;

View File

@ -207,7 +207,7 @@ extern int lxc_arguments_parse(struct lxc_arguments *args, int argc,
return ret; return ret;
} }
while (true) { for (;;) {
int c; int c;
int index = 0; int index = 0;

View File

@ -1101,7 +1101,7 @@ static int open_without_symlink(const char *target, const char *prefix_skip)
goto out; goto out;
} }
while (1) { for (;;) {
int newfd, saved_errno; int newfd, saved_errno;
char *nextpath; char *nextpath;