maint: while (1) → while (true)

This commit is contained in:
Paul Eggert committed 2021-06-26 18:40:26 -07:00
1 parent 18dbcae25a
commit 53bb0235d5
29 files changed
+47 -47

No files matched your search

+1 -1
View File
@@ -605,7 +605,7 @@ z85_encode (char const *restrict in, size_t inlen,
unsigned int val;
size_t outidx = 0;
while (1)
while (true)
{
if (inlen == 0)
{
+1 -1
View File
@@ -315,7 +315,7 @@ process_files (char **files, int bit_flags)
FTS *fts = xfts_open (files, bit_flags, NULL);
while (1)
while (true)
{
FTSENT *ent;
+1 -1
View File
@@ -335,7 +335,7 @@ process_files (char **files, int bit_flags)
FTS *fts = xfts_open (files, bit_flags, NULL);
while (1)
while (true)
{
FTSENT *ent;
+1 -1
View File
@@ -524,7 +524,7 @@ chown_files (char **files, int bit_flags,
FTS *fts = xfts_open (files, bit_flags | stat_flags, NULL);
while (1)
while (true)
{
FTSENT *ent;
+1 -1
View File
@@ -496,7 +496,7 @@ load_buffer (void)
if (bytes_wanted < hold_count)
bytes_wanted = hold_count;
while (1)
while (true)
{
b = get_new_buffer (bytes_wanted);
bytes_avail = b->bytes_alloc; /* Size of buffer returned. */
+1 -1
View File
@@ -306,7 +306,7 @@ cut_fields (FILE *stream)
That is because a non-delimited line has exactly one field. */
buffer_first_field = (suppress_non_delimited ^ !print_kth (1));
while (1)
while (true)
{
if (field_idx == 1 && buffer_first_field)
{
+1 -1
View File
@@ -313,7 +313,7 @@ batch_convert (char const *input_filename, char const *format,
line = NULL;
buflen = 0;
ok = true;
while (1)
while (true)
{
ssize_t line_length = getline (&line, &buflen, in_stream);
if (line_length < 0)
+1 -1
View File
@@ -2179,7 +2179,7 @@ dd_copy (void)
alloc_ibuf ();
alloc_obuf ();
while (1)
while (true)
{
if (status_level == STATUS_PROGRESS)
{
+1 -1
View File
@@ -253,7 +253,7 @@ dc_parse_stream (FILE *fp, char const *filename)
if (term == NULL || *term == '\0')
term = "none";
while (1)
while (true)
{
char *keywd, *arg;
bool unrecognized;
+1 -1
View File
@@ -684,7 +684,7 @@ du_files (char **files, int bit_flags)
{
FTS *fts = xfts_open (files, bit_flags, NULL);
while (1)
while (true)
{
FTSENT *ent;
+6 -6
View File
@@ -781,7 +781,7 @@ eval5 (bool evaluate)
trace ("eval5");
#endif
l = eval6 (evaluate);
while (1)
while (true)
{
if (nextarg (":"))
{
@@ -812,7 +812,7 @@ eval4 (bool evaluate)
trace ("eval4");
#endif
l = eval5 (evaluate);
while (1)
while (true)
{
if (nextarg ("*"))
fxn = multiply;
@@ -851,7 +851,7 @@ eval3 (bool evaluate)
trace ("eval3");
#endif
l = eval4 (evaluate);
while (1)
while (true)
{
if (nextarg ("+"))
fxn = plus;
@@ -881,7 +881,7 @@ eval2 (bool evaluate)
trace ("eval2");
#endif
l = eval3 (evaluate);
while (1)
while (true)
{
VALUE *r;
enum
@@ -960,7 +960,7 @@ eval1 (bool evaluate)
trace ("eval1");
#endif
l = eval2 (evaluate);
while (1)
while (true)
{
if (nextarg ("&"))
{
@@ -991,7 +991,7 @@ eval (bool evaluate)
trace ("eval");
#endif
l = eval1 (evaluate);
while (1)
while (true)
{
if (nextarg ("|"))
{
+2 -2
View File
@@ -520,7 +520,7 @@ elide_tail_lines_pipe (char const *filename, int fd, uintmax_t n_elide,
/* Always read into a fresh buffer.
Read, (producing no output) until we've accumulated at least
n_elide newlines, or until EOF, whichever comes first. */
while (1)
while (true)
{
n_read = safe_read (fd, tmp->buffer, BUFSIZ);
if (n_read == 0 || n_read == SAFE_READ_ERROR)
@@ -676,7 +676,7 @@ elide_tail_lines_seekable (char const *pretty_filename, int fd,
if (n_lines && bytes_read && buffer[bytes_read - 1] != line_end)
--n_lines;
while (1)
while (true)
{
/* Scan backward, counting the newlines in this bufferfull. */
+1 -1
View File
@@ -598,7 +598,7 @@ prjoin (struct line const *line1, struct line const *line2)
const struct outlist *o;
o = outlist;
while (1)
while (true)
{
if (o->file == 0)
{
+2 -2
View File
@@ -2980,7 +2980,7 @@ print_dir (char const *name, char const *realname, bool command_line_arg)
/* Read the directory entries, and insert the subfiles into the 'cwd_file'
table. */
while (1)
while (true)
{
/* Set errno to zero so we can distinguish between a readdir failure
and when readdir simply finds that there are no more entries. */
@@ -5112,7 +5112,7 @@ print_many_per_line (void)
size_t pos = 0;
/* Print the next row. */
while (1)
while (true)
{
struct fileinfo const *f = sorted_file[filesno];
size_t name_length = length_of_file_name_and_frills (f);
+1 -1
View File
@@ -86,7 +86,7 @@ main (int argc, char **argv)
enum nproc_query mode = NPROC_CURRENT_OVERRIDABLE;
while (1)
while (true)
{
int c = getopt_long (argc, argv, "", longopts, NULL);
if (c == -1)
+3 -3
View File
@@ -1387,7 +1387,7 @@ dump (void)
if (limit_bytes_to_format)
{
while (1)
while (true)
{
size_t n_needed;
if (current_offset >= end_offset)
@@ -1409,7 +1409,7 @@ dump (void)
}
else
{
while (1)
while (true)
{
ok &= read_block (bytes_per_block, block[idx], &n_bytes_read);
if (n_bytes_read < bytes_per_block)
@@ -1462,7 +1462,7 @@ dump_strings (void)
uintmax_t address = n_bytes_to_skip;
bool ok = true;
while (1)
while (true)
{
size_t i;
int c;
+1 -1
View File
@@ -837,7 +837,7 @@ find_occurs_in_text (int file_index)
/* Read and process a single input line or sentence, one word at a
time. */
while (1)
while (true)
{
if (word_regex.string)
+3 -3
View File
@@ -178,7 +178,7 @@ find_dir_entry (struct stat *dot_sb, struct file_name *file_name,
use_lstat = (parent_sb.st_dev != dot_sb->st_dev);
found = false;
while (1)
while (true)
{
struct dirent const *dp;
struct stat ent_sb;
@@ -279,7 +279,7 @@ robust_getcwd (struct file_name *file_name)
if (stat (".", &dot_sb) < 0)
die (EXIT_FAILURE, errno, _("failed to stat %s"), quoteaf ("."));
while (1)
while (true)
{
/* If we've reached the root, we're done. */
if (SAME_INODE (dot_sb, *root_dev_ino))
@@ -340,7 +340,7 @@ main (int argc, char **argv)
atexit (close_stdout);
while (1)
while (true)
{
int c = getopt_long (argc, argv, "LP", longopts, NULL);
if (c == -1)
+1 -1
View File
@@ -185,7 +185,7 @@ main (int argc, char **argv)
atexit (close_stdout);
while (1)
while (true)
{
int c = getopt_long (argc, argv, "eLmPqsz", longopts, NULL);
if (c == -1)
+1 -1
View File
@@ -590,7 +590,7 @@ rm (char *const *file, struct rm_options const *x)
FTS *fts = xfts_open (file, bit_flags, NULL);
while (1)
while (true)
{
FTSENT *ent;
+1 -1
View File
@@ -117,7 +117,7 @@ remove_parents (char *dir)
bool ok = true;
strip_trailing_slashes (dir);
while (1)
while (true)
{
slash = strrchr (dir, '/');
if (slash == NULL)
+1 -1
View File
@@ -124,7 +124,7 @@ main (int argc, char **argv)
atexit (close_stdout);
while (1)
while (true)
{
int option_index = 0;
int c = getopt_long (argc, argv, "+r:t:u:l:c", long_options,
+1 -1
View File
@@ -3552,7 +3552,7 @@ static void
merge_loop (struct merge_node_queue *queue,
size_t total_lines, FILE *tfp, char const *temp_output)
{
while (1)
while (true)
{
struct merge_node *node = queue_pop (queue);
+1 -1
View File
@@ -179,7 +179,7 @@ sysv_sum_file (char const *file, int print_name)
}
}
while (1)
while (true)
{
size_t bytes_read = safe_read (fd, buf, sizeof buf);
+1 -1
View File
@@ -277,7 +277,7 @@ dot_or_dotdot (char const *file_name)
static inline struct dirent const *
readdir_ignoring_dot_and_dotdot (DIR *dirp)
{
while (1)
while (true)
{
struct dirent const *dp = readdir (dirp);
if (dp == NULL || ! dot_or_dotdot (dp->d_name))
+3 -3
View File
@@ -58,7 +58,7 @@ buf_init_from_stdin (Buf *x, char eol_byte)
#define OBS (&(x->obs))
obstack_init (OBS);
while (1)
while (true)
{
char *buf = (char *) malloc (BUFFER_SIZE);
size_t bytes_read;
@@ -185,7 +185,7 @@ find_bol (const Buf *x,
tmp = line_ptr_decrement (x, last_bol);
last_bol_ptr = tmp.ptr;
i = tmp.i;
while (1)
while (true)
{
char *nl = memrchr (x->p[i].start, last_bol_ptr, eol_byte);
if (nl)
@@ -250,7 +250,7 @@ tac_mem ()
bol.i = x.n_bufs - 1;
bol.ptr = ONE_PAST_END (&x, bol.i);
while (1)
while (true)
{
Line_ptr new_bol;
if (! find_bol (&x, &bol, &new_bol, eol_byte))
+1 -1
View File
@@ -505,7 +505,7 @@ copy_to_temp (FILE **g_tmp, char **g_tempfile, int input_fd, char const *file)
if (!temp_stream (&fp, &file_name))
return -1;
while (1)
while (true)
{
size_t bytes_read = safe_read (input_fd, G_buffer, read_size);
if (bytes_read == 0)
+6 -6
View File
@@ -453,7 +453,7 @@ dump_remainder (bool want_header, char const *pretty_filename, int fd,
uintmax_t n_remaining = n_bytes;
n_written = 0;
while (1)
while (true)
{
char buffer[BUFSIZ];
size_t n = MIN (n_remaining, BUFSIZ);
@@ -641,7 +641,7 @@ pipe_lines (char const *pretty_filename, int fd, uintmax_t n_lines,
tmp = xmalloc (sizeof (LBUFFER));
/* Input is always read into a fresh buffer. */
while (1)
while (true)
{
n_read = safe_read (fd, tmp->buffer, BUFSIZ);
if (n_read == 0 || n_read == SAFE_READ_ERROR)
@@ -780,7 +780,7 @@ pipe_bytes (char const *pretty_filename, int fd, uintmax_t n_bytes,
tmp = xmalloc (sizeof (CBUFFER));
/* Input is always read into a fresh buffer. */
while (1)
while (true)
{
n_read = safe_read (fd, tmp->buffer, BUFSIZ);
if (n_read == 0 || n_read == SAFE_READ_ERROR)
@@ -900,7 +900,7 @@ start_lines (char const *pretty_filename, int fd, uintmax_t n_lines,
if (n_lines == 0)
return 0;
while (1)
while (true)
{
char buffer[BUFSIZ];
size_t bytes_read = safe_read (fd, buffer, BUFSIZ);
@@ -1160,7 +1160,7 @@ tail_forever (struct File_spec *f, size_t n_files, double sleep_interval)
last = n_files - 1;
while (1)
while (true)
{
size_t i;
bool any_input = false;
@@ -1617,7 +1617,7 @@ tail_forever_inotify (int wd, struct File_spec *f, size_t n_files,
ensure that watched files can be re-added when following by name.
This loop blocks on the 'safe_read' call until a new event is notified.
But when --pid=P is specified, tail usually waits via the select. */
while (1)
while (true)
{
struct File_spec *fspec;
struct inotify_event *ev;
+1 -1
View File
@@ -452,7 +452,7 @@ tsort (char const *file)
init_tokenbuffer (&tokenbuffer);
while (1)
while (true)
{
/* T2. Next Relation. */
size_t len = readtoken (stdin, DELIM, sizeof (DELIM) - 1, &tokenbuffer);