while (1) -> for (;;)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216
diff --git a/got/got.c b/got/got.c
index 6498094..41b8e41 100644
--- a/got/got.c
+++ b/got/got.c
@@ -277,7 +277,7 @@ check_ancestry(struct got_worktree *worktree, struct got_object_id *commit_id,
err = got_commit_graph_iter_start(graph, head_commit_id, repo);
if (err)
goto done;
- while (1) {
+ for (;;) {
struct got_object_id *id;
if (sigint_received || sigpipe_received)
@@ -759,7 +759,7 @@ print_commits(struct got_object_id *root_id, struct got_repository *repo,
err = got_commit_graph_iter_start(graph, root_id, repo);
if (err)
goto done;
- while (1) {
+ for (;;) {
struct got_commit_object *commit;
struct got_object_id *id;
diff --git a/lib/blame.c b/lib/blame.c
index 3de5cb3..7774b2b 100644
--- a/lib/blame.c
+++ b/lib/blame.c
@@ -348,7 +348,7 @@ blame_open(struct got_blame **blamep, const char *path,
goto done;
id = NULL;
- while (1) {
+ for (;;) {
struct got_object_id *next_id;
err = got_commit_graph_iter_next(&next_id, graph);
diff --git a/lib/fileindex.c b/lib/fileindex.c
index f42c329..a868d40 100644
--- a/lib/fileindex.c
+++ b/lib/fileindex.c
@@ -818,7 +818,7 @@ diff_fileindex_dir(struct got_fileindex *fileindex,
TAILQ_INIT(&dirlist);
- while (1) {
+ for (;;) {
struct got_pathlist_entry *new = NULL;
struct dirent *dep = NULL;
diff --git a/lib/object_create.c b/lib/object_create.c
index 713cdf2..0a94c65 100644
--- a/lib/object_create.c
+++ b/lib/object_create.c
@@ -152,7 +152,7 @@ got_object_blob_create(struct got_object_id **id, const char *ondisk_path,
err = got_ferror(blobfile, GOT_ERR_IO);
goto done;
}
- while (1) {
+ for (;;) {
char buf[8192];
ssize_t inlen;
diff --git a/lib/object_parse.c b/lib/object_parse.c
index e152249..33ea7ac 100644
--- a/lib/object_parse.c
+++ b/lib/object_parse.c
@@ -903,7 +903,7 @@ got_read_file_to_mem(uint8_t **outbuf, size_t *outlen, FILE *f)
remain = blocksize;
total = 0;
- while (1) {
+ for (;;) {
if (remain == 0) {
uint8_t *newbuf;
newbuf = reallocarray(buf, 1, total + blocksize);
diff --git a/lib/privsep.c b/lib/privsep.c
index b138fdd..1601edd 100644
--- a/lib/privsep.c
+++ b/lib/privsep.c
@@ -757,7 +757,7 @@ get_more:
if (err)
goto done;
- while (1) {
+ for (;;) {
struct imsg imsg;
size_t n;
size_t datalen;
diff --git a/lib/reference.c b/lib/reference.c
index 71cd054..d1b38a6 100644
--- a/lib/reference.c
+++ b/lib/reference.c
@@ -625,7 +625,7 @@ gather_on_disk_refs(struct got_reflist_head *refs, const char *path_refs,
if (d == NULL)
goto done;
- while (1) {
+ for (;;) {
struct dirent *dent;
struct got_reference *ref;
char *child;
@@ -723,7 +723,7 @@ got_ref_list(struct got_reflist_head *refs, struct got_repository *repo)
char *line;
size_t len;
const char delim[3] = {'\0', '\0', '\0'};
- while (1) {
+ for (;;) {
line = fparseln(f, &len, NULL, delim, 0);
if (line == NULL) {
if (feof(f))
@@ -933,7 +933,7 @@ delete_packed_ref(struct got_reference *delref, struct got_repository *repo)
err = got_error_prefix_errno2("fopen", packed_refs_path);
goto done;
}
- while (1) {
+ for (;;) {
char *line;
size_t len;
const char delim[3] = {'\0', '\0', '\0'};
diff --git a/lib/worktree.c b/lib/worktree.c
index 3aab971..1ed6f1e 100644
--- a/lib/worktree.c
+++ b/lib/worktree.c
@@ -1068,7 +1068,7 @@ get_file_status(unsigned char *status, struct stat *sb,
goto done;
}
hdrlen = got_object_blob_get_hdrlen(blob);
- while (1) {
+ for (;;) {
const uint8_t *bbuf = got_object_blob_get_read_buf(blob);
err = got_object_blob_read_block(&blen, blob);
if (err)
diff --git a/libexec/got-read-blob/got-read-blob.c b/libexec/got-read-blob/got-read-blob.c
index d3ec83a..f28286d 100644
--- a/libexec/got-read-blob/got-read-blob.c
+++ b/libexec/got-read-blob/got-read-blob.c
@@ -67,13 +67,13 @@ main(int argc, char *argv[])
}
#endif
- while (1) {
+ for (;;) {
struct imsg imsg, imsg_outfd;
FILE *f = NULL;
size_t size;
struct got_object *obj = NULL;
uint8_t *buf = NULL;
-
+
memset(&imsg, 0, sizeof(imsg));
imsg.fd = -1;
memset(&imsg_outfd, 0, sizeof(imsg_outfd));
diff --git a/libexec/got-read-commit/got-read-commit.c b/libexec/got-read-commit/got-read-commit.c
index 649c1df..b015c35 100644
--- a/libexec/got-read-commit/got-read-commit.c
+++ b/libexec/got-read-commit/got-read-commit.c
@@ -101,7 +101,7 @@ main(int argc, char *argv[])
}
#endif
- while (1) {
+ for (;;) {
struct imsg imsg;
FILE *f = NULL;
struct got_commit_object *commit = NULL;
diff --git a/libexec/got-read-object/got-read-object.c b/libexec/got-read-object/got-read-object.c
index ffe426e..f3b5792 100644
--- a/libexec/got-read-object/got-read-object.c
+++ b/libexec/got-read-object/got-read-object.c
@@ -78,7 +78,7 @@ main(int argc, char *argv[])
}
#endif
- while (1) {
+ for (;;) {
if (sigint_received) {
err = got_error(GOT_ERR_CANCELLED);
break;
diff --git a/libexec/got-read-pack/got-read-pack.c b/libexec/got-read-pack/got-read-pack.c
index 251c3ea..509295e 100644
--- a/libexec/got-read-pack/got-read-pack.c
+++ b/libexec/got-read-pack/got-read-pack.c
@@ -507,7 +507,7 @@ main(int argc, char *argv[])
return 1;
}
- while (1) {
+ for (;;) {
imsg.fd = -1;
if (sigint_received) {
diff --git a/libexec/got-read-tag/got-read-tag.c b/libexec/got-read-tag/got-read-tag.c
index 4c84b09..aff70b3 100644
--- a/libexec/got-read-tag/got-read-tag.c
+++ b/libexec/got-read-tag/got-read-tag.c
@@ -96,7 +96,7 @@ main(int argc, char *argv[])
}
#endif
- while (1) {
+ for (;;) {
struct imsg imsg;
FILE *f = NULL;
struct got_tag_object *tag = NULL;
diff --git a/libexec/got-read-tree/got-read-tree.c b/libexec/got-read-tree/got-read-tree.c
index e724345..c3fc7aa 100644
--- a/libexec/got-read-tree/got-read-tree.c
+++ b/libexec/got-read-tree/got-read-tree.c
@@ -95,7 +95,7 @@ main(int argc, char *argv[])
}
#endif
- while (1) {
+ for (;;) {
struct imsg imsg;
FILE *f = NULL;
struct got_tree_object *tree = NULL;