Commit 656b1f76d3a6f52318782284fa83ae47894cbffb

joshua stein 2019-05-11T14:26:12

while (1) -> for (;;)

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;