]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: while (1) → while (true)
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 27 Jun 2021 01:23:52 +0000 (18:23 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 27 Jun 2021 01:40:26 +0000 (18:40 -0700)
29 files changed:
src/basenc.c
src/chcon.c
src/chmod.c
src/chown-core.c
src/csplit.c
src/cut.c
src/date.c
src/dd.c
src/dircolors.c
src/du.c
src/expr.c
src/head.c
src/join.c
src/ls.c
src/nproc.c
src/od.c
src/ptx.c
src/pwd.c
src/realpath.c
src/remove.c
src/rmdir.c
src/runcon.c
src/sort.c
src/sum.c
src/system.h
src/tac-pipe.c
src/tac.c
src/tail.c
src/tsort.c

index 7e22363bf496f8740e5d62573ab35d1f035c6446..5c97a36526bd13fee1c2905b44dffc39d372e9a6 100644 (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)
         {
index dc2258de0ea4a6b037a82495ee5c321a8df8c6dc..88010848e59da78c336f452d9739dbeab1f43a37 100644 (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;
 
index 78d9c9cba4b67c2022478b75e9bed4013ce77017..160a0c537b630dcf4e63aeab4ecb76c068e4368b 100644 (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;
 
index a0b2f670f6c9da105405331a5e065c8549d3d812..4d816de4a82578e84f35b6f36fab731f597df8d1 100644 (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;
 
index f188e88940af87a7ff2bbe6e0992b4264e0e7e3e..e1fb66ed247a9d578c96472e1c8d9f8dbadda442 100644 (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. */
index 78b82c80e51b76769e7e778f23ddf4f3b660708d..f4d44c2113ce250030d6459088df6ed14da8cf7a 100644 (file)
--- a/src/cut.c
+++ b/src/cut.c
@@ -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)
         {
index d5eebaf253549a6a9ac666cde1beeeeff47d538e..4a7a4e24364050d81707703cd55d71afc20d49d2 100644 (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)
index d284357a47ffc3550800201e294832e4ad226d78..fc5108f8b7d390f707f180fff7f81740ce620e49 100644 (file)
--- a/src/dd.c
+++ b/src/dd.c
@@ -2179,7 +2179,7 @@ dd_copy (void)
   alloc_ibuf ();
   alloc_obuf ();
 
-  while (1)
+  while (true)
     {
       if (status_level == STATUS_PROGRESS)
         {
index fea0cdf018880f1b36bd0276ccf9ea9e018b65e7..b765ded9f46efb2c10d22cb33e024bde54ccfaa2 100644 (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;
index d4760a36c89d454a40b8103651882cedef667336..efd519706c884a83374130c171e649af6f18173d 100644 (file)
--- a/src/du.c
+++ b/src/du.c
@@ -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;
 
index ec76f7607b09dda6e78db45c200f54843a17f89b..41185a8f876fefaf03d0d1ba3ed301944b909626 100644 (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 ("|"))
         {
index 844c5636a1f37f0275e066d91b448d3327672447..7b2a440418fe332cf04bec73b3d271a4cf0cc4c1 100644 (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.  */
 
index 57f4665bcb74920845dc8b276b8f92331e98a737..f22ffda53069995cb4853e472117001c1a689b04 100644 (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)
             {
index 4586b5eccd9113fc7caf493162e15c74dac4b243..1b20f17fea7404e490494677c0954b1d5727c069 100644 (file)
--- a/src/ls.c
+++ b/src/ls.c
@@ -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);
index e06b7a4310b44dc6556e36c1f9b49eb364a72392..55a51bfbe3f7262f0f694e0e10cc49712af7e2a1 100644 (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)
index 5b2d507a120306798b446c6eb6967aaf84509a2d..f04e0ccb70b995f04468ff3d907cf7de88fd9e45 100644 (file)
--- a/src/od.c
+++ b/src/od.c
@@ -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;
index fc4d0912faddd73bbc86edde4077c456c77936d7..c488b1192d7afcd58771981b1ef29a81adf60d5a 100644 (file)
--- a/src/ptx.c
+++ b/src/ptx.c
@@ -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)
 
index 3a18c3d818012dba898e02184e745a16309e0adb..5dfda31bd71f75c326670a0d5af7cb43cd0b49fb 100644 (file)
--- a/src/pwd.c
+++ b/src/pwd.c
@@ -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)
index 4c9ffbcb4bf28b983dc6dd018d7eef5e046ed222..8e4aabfdf14ecbd760f282c2462c841a9ebc86a1 100644 (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)
index da380e0a7ead283394fa63537794d685d421ec72..5dd0479e6b3025891f44174d8400da45121d58ea 100644 (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;
 
index 3a9911ff06a54f079aaa555a403248a63ae8b372..149d4659a9065cc1998d1c9b6b1fd22acd707cd0 100644 (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)
index fda8bb398efb483f21624338b248d9e22cdf27e9..716170092d04808abebaf9f6f7686843703ee72a 100644 (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,
index d98796b967c55fca893a494eaa9f864b74e8de90..451bfe08af98a97a5a2bb19f230ddba5c12f3f82 100644 (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);
 
index 218db808d5109e5fcdaa572acf806fc3f9755182..f9641dbb1dbadd43f06e7cd2aac4b3acb28fb055 100644 (file)
--- a/src/sum.c
+++ b/src/sum.c
@@ -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);
 
index 676f5f562b592d3507136e0c7b8dfe74e07e1ac7..ce264b1217968bebf46c3686739de7f1743a3faa 100644 (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))
index 5fefd631bb384e2259b8fde42cfa530920159d86..5192607d99972084f396e2ecbcb2be3c675c182c 100644 (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))
index 1a01c005e9a246aff563cd47a2ae4617f88d5fd5..cbc3deac99ed95fe7769f943283d6d22b5d9106f 100644 (file)
--- a/src/tac.c
+++ b/src/tac.c
@@ -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)
index b91fcfd82c07a84a0d0ddf31309150ffa7387028..7c3ae22d95ab5c017eaf63db045eb6a874ab6fa9 100644 (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;
index 92bd1b2afe99371b56ef299acfcbfd906c07dd1c..33b3419c0a486fa8416afd91d2dc89e5013a531c 100644 (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);